Focal Point Winter Weather Jobsheets

Change Commute Times

Purpose:

This jobsheet demonstrates changing the local commute time hours for triggering a commute-related impacts phrase (as well as zones to exclude from this phrasing if desired)

Tasks:

 

AT-A-GLANCE:

  • What? Adjust start and end hours in the morning/eveningCommuteTimeRange list variables of the commutePhraseConfiguration method, in an override of LocalVariables.py
  • Zone Removal. Add ugc codes (in comma separated, quoted list) to exclude from commute phrasing in morning/eveningCommuteRemovalZones

Follow the steps below for more detailed guidance.

  1. [OPTIONAL] Create a hazard during commute times in your area to see the initial phrasing
    1. Launch Hazard Services in your desired perspective (e.g. GFE) with the Winter Settings file
    2. Create a hazard event
    3. Select a category (e.g. Winter) and hazard (e.g. BZ.W),
    4. Adjust the event start/end times to span a commute period (baseline code has 6-7am and 4-5pm local)
    5. Leave the "Automatically Generated Impacts" checkbox selected, and click "Preview" to generate a product
    6. Look at the "Impacts" text field for phrasing related to commute impacts
      1. Try expanding the event time and previewing again if the commute phrase doesn't appear
  2. Switch to the Localization Perspective by clicking on the "Open Perspective" icon at the top-right of your CAVE window, and choosing "Localization"
  3. In the Localization Perspective, navigate to the Utilities sub-directory under the Hazard Services folder.
  4. Double click on LocalVariables.py to show the available versions
  5. Create a user override version if none exists (user override is best practice for testing changes):
    1. If there is only a BASE version: right click on BASE and select Create Override File, then select User
    2. If there is another version (e.g. SITE) you wish to use: right click on that file and select Copy To, then select User (this lets you work on an updated SITE version to replace the original when you're finished)
  6. Double click on the USER version of LocalVariables.py to open it for editing
  7. Open a reference copy of the existing LocalVariables.py file, which will be used for comparing to and copying existing code for overrides.
    1. It's typically best to open the BASE version because most methods have not already been overridden in a higher-level override
  8. In the reference file you opened, scroll or search to find the "commutePhraseConfiguration" method (whose first line appears as "def commutePhraseConfiguration(self, zones)" in LocalVariables.py)
  9. Once found, select the entire commutePhraseConfiguration method by clicking and dragging from (and including) the "def commutePhraseConfiguration(self, zones):" line which begins the function, all the way to (and including) the last line of the function which has the "return morningCommuteTimeRange, eveningCommuteTimeRange" statement.
  10. Copy the selected contents by right-clicking and selecting "Copy" from the pop-up menu, or by hitting CTRL-C on your keyboard
  11. Switch back to the USER override you were working on
  12. Paste the commutePhraseConfiguration method into your USER override on a blank line after the "class..." and "pass" lines (or after any pre-existing overrides in this file), by right-clicking and selecting "Paste" from the pop-up menu, or by hitting CTRL-V on your keyboard
  13. In the USER copy of the commutePhraseConfiguration method you just pasted in, locate the variables containing "CommuteTimeRange" shown below for both morning and evening periods:
    # Min/Max of hours (local time) where the morning commute could be affected
    morningCommuteTimeRange = [6, 7]
    # Min/Max of hours (local time) where the evening commute could be affected
    eveningCommuteTimeRange = [16, 17]
  14. In these variables, change the two integers within the [ ] brackets to the start and end times of your morning or evening commute , respectively, as seen below (changes shown in bold):
    # Min/Max of hours (local time) where the morning commute could be affected
    morningCommuteTimeRange = [5, 8] # Changed start and end time
    # Min/Max of hours (local time) where the evening commute could be affected
    eveningCommuteTimeRange = [16, 19] # Changed only end time
    1. Keep in mind the hours are local, not UTC
    2. Your changes can be as extensive or minimal as needed - e.g. only to the one of the starting/ending numbers, or only to the morning or evening commutes
  15. [OPTIONAL] Exclude certain zones from morning or evening commute phrases
    1. If you don't need this, skip to saving your changes in step 20​​​​​​​
    2. The following steps will show how to prevent certain zones from displaying commute phrases (e.g. remote, inapplicable areas)
  16. In this same USER copy of the commutePhraseConfiguration method, locate the variables containing "CommuteRemovalZones" (just a little below the TimeRange variables) as shown below:
    morningCommuteRemovalZones = []
    eveningCommuteRemovalZones = []
  17. ​​​​​​​Identify one or more zones which you intend to exclude from commute phrasing (this jobsheet uses COZ036 and COZ035 from the BOU domain). You will need the ugc codes for each zone in subsequent steps
    1. Look up the ugc code in your AreaDictionary or by loading the forecast zones map in CAVE if you're unsure.
  18. Now populate the morningCommuteRemovalZones list  ​​​​​​​with a quoted, comma-separated list of your ugc codes, as shown below for the morning commute (changes shown in bold):
    morningCommuteRemovalZones = ["COZ035", "COZ036"] # comma-separated list of zones not to use morning commute phrases for
    eveningCommuteRemovalZones = []
    1. Though not shown above, you may also edit eveningCommuteRemovalZones in the same fashion (the excluded zones do not have to match between morning and evening)
    2. NOTE: Commute phrases will still appear if the hazard overlaps with zones which have not been removed through these variables
  19. [NO ACTION NEEDED] Like most Hazard Services methods, the code leaves more advanced logic wide open - for example you could code zone-dependent commute times if desired.
  20. When finished, save the file by hitting Ctrl+S, or selecting Save from the File menu
    1. If a "File Version Conflict" is encountered, click OK to accept merge
    2. In the two-panel "Merge" tab that opens, make no changes, once again save the file by hitting Ctrl+s, then close the "Merge" tab
    3. When a "File Changed" message appears,  click Yes.
    4. This behavior will only be encountered each time a new override file that did not exist before is created and saved
  21. [OPTIONAL, RECOMMENDED] Verify your changes... ​​​​​​​In GFE, the next time you issue a hazard whose start and end times overlap these commute time periods, and also if the "Automatically Generated Impacts (derived from grids)" Impacts checkbox is checked​​​​​​​, you should see a phrase like "The hazardous conditions could impact the morning commute" (or evening, or both) automatically appear in the Impacts Bullet. 
    1. Note that commute phrases are only triggered when hazard start or end times go beyond the commute start or end times, rather than perfectly lining up (for example a hazard ending at 6AM and morning commute starting at 6AM would not technically overlap, so a commute phrase would not be triggered)
  22. Finished!