Focal Point Non-Precipitation Weather Jobsheets

Change (or Remove) Zone Type Text in Where Bullet

Purpose:

A default zone type phrase (e.g. "Counties", "Parishes", etc) is added to the end of the zone listings in the Where bullet of HazSimp products (PIL dependent). This jobsheet shows how to change (or even remove) that phrase.

Tasks:

AT-A-GLANCE:

  • Where? Override the zoneType method in LocalVariables.py
  • How? For each PIL, use the singular form of your default zone type, OR return an empty string to skip using this feature
  • PIL-dependent. Each PIL (e.g. WSW) can have a different zone type associated with it.
  • Scope. This default zoneType applies to all UGCs which do not have a localWherePhrase override or a "zoneType" attribute in AreaDictionary​​​​

Follow the steps below for more detailed guidance.

  1. [OPTIONAL] Create a hazard to see the initial "Where" phrasing
    1. Launch Hazard Services in your desired perspective (e.g. GFE)
    2. Use a freehand polygon or other method to draw a hazard in your area
    3. Select a category (e.g. Winter) and hazard (e.g. BZ.W), then click "Preview" to generate a product
      1. Note that each PIL (e.g. WSW) can have a different zoneType, so pick a hazard which will trigger the product type you want to change
    4. Look at the "Where:" text field to see the current phrasing of the "Where" text for your affected zone(s).
      1. You must be using a HazSimp formatter to see the Where Bullet product part
      2. Notice the final word at the end of the zone list (e.g. "Counties", "Parishes", or other zone type) - this text is what we will change.
  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 "zoneType" method (whose first line appears as "def zoneType(self):" in LocalVariables.py)
  9. Once found, select the entire zoneType method by clicking and dragging from (and including) the 'def zoneType(self, category):' line which begins the function, all the way to (and including) the last line of the function which has the 'return mapping.get(category, "")' statement
    1. This method is fairly small so you will only be copying a few lines'
  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 zoneType method into your USER override on a blank line after the "class..." and "pass" lines (or after any pre-existing override methods in the 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 zoneType method you just pasted in, edit the quoted text after the PIL (e.g. WSW) whose zone type you want to alter, depending on your desired outcome...
    1. To set your default zoneType as something other than "County" (e.g. Parish), edit the method as follows (bold shows changes):
      def zoneType(self, category):
          ​​​​​​​​​​​mapping = {
              "WSW": "Parish" # use the SINGULAR form
              "MMW": "",
              "NPW": "County",
      ​​​​​​​    }
          return mapping.get(category, "")
      
      ... be sure to use the singular form.  A utility method (makePlural in Utilities/TextProductCommon.py) handles pluralizing these zone types in the final product, if needed.
    2. To completely remove the zone type phrase in your "Where" bullet (for example if your AreaDictionary already includes the zone type in the ugcName fields, making this label redundant), simply assign an empty string after your PIL as follows (bold shows changes):
      def zoneType(self, category):
      ​​​​​​​    ​​​​​​​​​​​mapping = {
      ​​​​​​​        "WSW": "" # use NO default zone type phrase
      ​​​​​​​        "MMW": "",
      ​​​​​​​        "NPW": "County",​​​​​
      ​​​​​​​    }
      ​​​​​​​    return mapping.get(category, "")
      
  14. [NO ACTION REQUIRED] Be aware that the following conditions will overrule what you've set as the default zoneType in this method:
    1. Your AreaDictionary includes a "zoneType" label for a ugc... if so, that label will appear for those ugcs in the Where text
    2. [HIGHEST PRIORITY] A substitution is triggered from the localWherePhrase for any of your hazard's ugcs. In this case, no zone labels are used at all​​​​​​​ (because the localWherePhrase results do not include zone labeling and completely replace the default "Where" phrasing)
  15. 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
  16. [OPTIONAL, HIGHLY RECOMMENDED] Test your new, default zone type label ​​​​​​​by returning to your previous perspective (e.g. GFE) and issuing a hazard in your area
    1. Check the previewed "Where" text and see if the zone label at the end of the ugc names has updated.  Remember to use generate the same PIL whose zoneType you changed for this test.
    2. TROUBLESHOOTING: If you do not see the change, is there a localWherePhrase match which is interfering?  Or is there a zoneType in the AreaDictionary for one of the hazard's ugcs?  This zoneType method only applies when there's no special handling for a ugc code, so it's best to test on zones with neither of these special conditions.
  17. Finished!

​​​​​​​​​​​