Focal Point Winter Weather Jobsheets

Change Local CTA

Purpose:

This jobsheet changes the default "Local CTA" value which is appended to your CTAs when grid-based CTAs are used

Tasks:

AT-A-GLANCE:

  • What? Alter the text stored by the "ctas" variable of the localCTA method, in an override of LocalVariables.py
  • More options. Optionally configure other logic in this method, such as state-dependent CTAs, to have a more dynamic localCTA appended to your product.

Follow the steps below for more detailed guidance.

  1. [OPTIONAL] Create a hazard for for your area to review the current local CTA phrase
    1. Launch Hazard Services in your desired perspective (e.g. GFE)
    2. Draw a hazard in your area using the freehand polygon or other method
    3. Select a category (e.g. Winter) and hazard (e.g. BZ.W),
    4. Leave the "Automatically Generated CTAs" checkbox under "Calls to Action" selected, then click "Preview" to generate a product
    5. Look at the "Calls to Action" text field (near the bottom) and review the text being used
      1. The last sentence is typically where your local CTA will be appended (after other auto-generated text).
      2. If baseline, the localCTA should appear as "The latest road conditions for the state you are calling from can be obtained by calling 5 1 1."  This jobsheet will change that text.
  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 "localCTA" method (whose first line appears as "def localCTA(self, eventDicts):" in LocalVariables.py)​​​​​​​
  9. Once found, select the entire localCTA method by clicking and dragging from (and including) the "def localCTA(self, eventDicts):" line which begins the function, all the way to (and including) the last line of the function which has the "return finalCTA" 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 localCTA method into your USER override on a blank line after the "class..." and "pass" lines, by right-clicking and selecting "Paste" from the pop-up menu, or by hitting CTRL-V on your keyboard
    1. If you already have overrides in your USER file, just paste the localCTA method anywhere after the existing overrides
  13. In the USER copy of the localCTA method you just pasted in, identify the line containing 'ctas = ("...")' under the "#Generic option" comment​​​​​​​. In a baseline file, this is likely to appear as follows:
    #Generic option
    ​​​​​​​ctas = ("The latest road conditions for the state you are calling from "
    ​​​​​​​        "can be obtained by calling 5 1 1.")
    
    1. This structure of "ctas" variable sets a simple static CTA that will be appended to your products (as opposed to one which changes for each state)
  14. Edit the quoted text within parentheses for your 'ctas=()' variable to a message suitable for your CWA. An example is shown below (changes in bold):
    #Generic option
    ​​​​​​​ctas = ("This is a new override of the local CTA.") # Replace with more helpful text for your area
    1. For readability, feel free to use multiple lines to type this message (like the baseline text did), but if so be sure to close and reopen the quotation marks on each line.  All text in the parentheses will be joined when the product is created.
  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, RECOMMENDED] Verify your localCTA has changed​​​​​​​ by re-generating a product for some hazard
    1. Switch back to GFE (or whichever localization you were previously using) to once again view Hazard Services
    2. Dismiss any open Product Editor window, and then click Preview in the HID for your BZ.W hazard to re-launch the Product Editor
      1. Make sure to leave the checkbox selected for "Automatically Generated CTAs (derived from grids)"
    3. Scroll down and ​​​​​​​observe the UPDATED text ​​​​​​​of the "Calls to Action" text:
      1. Your updated phrase should appear as the last sentence in the text box
  17. [BONUS STEP] If you have a need for your local CTA to be state-dependent, follow these steps to set that up
    1. Switch back to the Localization Perspective and your USER override of LocalVariables.py
    2. Follow the guidance of the commented "Multi-state option" example to add an uncommented entry like the following (alter the states and messaging as suits your CWA):
      #Multi-state option
      ​​​​​​​ctas = [("Oklahoma", "Call 844-465-4997 for road conditions."),
      ​​​​​​​        ("Texas", "Call 800-452-9292 for road conditions.")]​​​​​​​
    3. To ensure that the generic CTA doesn't interfere with the multi-state one, comment or delete the non-state-specific "ctas=()" line which should be found under a "#Generic option" comment (To help differentiate, note that the state-specific option is defined using square [ ] brackets with comma-separated parentheses within, while the generic option uses only parentheses)
    4. Save your updates and accept or dismiss any file conflict messages
    5. Returning to GFE​​​​​​​ or the perspective with Hazard Services open, test creating and previewing different hazards in different states to make sure that the "Calls to Action" text correctly adjusts to the state your hazard is in
  18. Task Complete!