Exercises

  Thresholds and Variables Exercises
     Thresholds Exercise 1: "Modifying a Pre-existing Override"
     Thresholds Exercise 2: "Working with the temporalCoverage_percentage"
     Thresholds Exercise 3: "Working with a Non-linear Threshold"
     Thresholds Exercise 4: "Basing a Threshold on the Current Edit Area"
   Product Component Exercises
     Component Exercise 1: "Working with Analysis-Driven Wind Phrasing"
     Component Exercise 2: "Working with Analysis-Driven Weather Phrasing"
     Component Exercise 3: "Choosing an Alternate Phrase"
     Component Exercise 4: "Customizing a Phrase"
     Component Exercise 5: "Working with Basic Local Effects"
  Configurable Issuance Exercises
     Configurable Issuance Exercise 1: "Working with Configurable Issuance"
  Headline Exercises
     Headline Exercise 1: "Generating Headlines"
     Headline Exercise 2: "Altering the allowedHazards"
  Simple Tabular Product Exercises
      Simple Tabular Product Exercise 1:  "Create a Weather Element by Area Table Product"
      Simple Tabular Product Exercise 2:  "Create an Area by Period Table Product"
  Smart Tabular Product Exercises
      Smart Tabular Exercise 1 : "Working with the SmartElementTable"
      Smart Tabular Exercise 2 : "Extending the SmartElementTable"
      Smart Tabular Exercise 3 : "Working with the FWFTable"
      Smart Tabular Exercise 4 : "Extending the FWFTable"
  Narrative Product Exercises
      Narrative Exercise 1: "Accessing the Statistics Dictionary"
      Narrative Exercise 2: "Narrative Tree Processing Rules"
      Narrative Exercise 3: "Working with Phrase_Test_Local"
      Narrative Exercise 4: "Working with Local_Effects_Test_Local"
   Phrase Exercises
      Phrase Exercise 1: "Overriding a Word Method"
      Phrase Exercise 2: "Inter-phrase Dependency"
      Phrase Exercise 3: "Phrase Anatomy"
      Phrase Exercise 4: "Creating a New Narrative Product"


NOTE: For these exercises, you will be working with the ZFP_<site>_Overrides file. For these Exercises, use the Fcst database instead of Official.

Thresholds and Variables Exercises

Thresholds Exercise 1: "Modifying a Pre-existing Override"
  1. In the first period over which the ZFP will run, set up "RW" in the Wx grid and a 10 percent PoP value.  Be sure and Save your grids to the Fcst database.
  2. Run the ZFP using the Fcst database and notice that no weather is reported.
  3. Open the ZFP_<site>_Overrides file using the Localization perspective to modify Text Products.
  4. Open the WxPhrases class in the Text Utilities Window of the Define Text Products Dialog using MB3-->New on the Text Products folder. Locate the "pop_wx_lower_threshold" method and copy and paste it into your Overrides file. Now change the default value of 20 percent to 10.
  5. Re-run the ZFP and verify that rain showers are now reported.
Thresholds Exercise 2: "Working with the temporalCoverage_percentage"
  1. Open the SampleAnalysis class using Localization perspective and browsing to the Text Utilities folder.
  2. Find the "temporalCoverage_percentage" method. Copy it into the ZFP_<site>_Overrides file at the end.
  3. Create a HeatIndex grid that covers the first 2 hours of the first period over which the ZFP will run. Set the value for this grid to 110 degrees.
  4. Create a HeatIndex grid that covers the last 10 hours of the first period over which the ZFP will run. Copy the MaxT grid into this HeatIndex grid.
  5. Save your data and run the ZFP. Note inclusion of the HeatIndex phrase. Even though the HeatIndex grid does not cover 20 percent of the 12-hour time period, it is included since the ENTIRE grid falls within the 12-hour time period.
  6. Now extend the first HeatIndex grid into the prior period by 2 hours and run the ZFP again. Note that HeatIndex is not reported since the first HeatIndex grid does not cover 20 percent of the 12-hour time period.
  7. Change the "temporalCoverage_percentage" from 20 percent to 10 in your ZFP_<site>_Overrides file and Save.
  8. Run the ZFP again and note the inclusion of the HeatIndex phrase since we lowered the threshold for grid inclusion.
Thresholds Exercise 3: "Working with a Non-linear Threshold"
  1. Locate the "minimum_range_nlValue_dict" method within the ZFP_<site>_Overrides file.
  2. Set-up a non-linear dictionary for the minimum range so that values below 40 mph will have a range of 5 mph and those above will have a range of 10 mph.
  3. Set up a Wind grid with values between 45 and 65 mph and verify that the phrasing is in 10 mph ranges when you run the ZFP.
  4. Set up a Wind grid with values between 15 and 35 mph and verify that the phrasing is in 5 mph ranges when you run the ZFP.

Thresholds Exercise 4: "Basing a Threshold on the Current Edit Area"

  1. Use the "currentAreaContains" method to return different "pop_wx_lower_threshold" values depending on the current edit area.
  2. Run the ZFP to verify that your override works as intended.

Product Component Exercises

Component Exercise 1: "Working with Analysis-Driven Wind Phrasing"
  1. Copy the entire"Period_1" Product Component method from the AreaFcst standard file into the ZFP_<site>_Overrides file.
  2. Make sure you have significant and variable Winds in the first period for the edit areas over which the ZFP will run. They should be above 5 knots and include minimum and maximum values that range over at least 25 knots. They should also vary every 3 hours.
  3. Run the ZFP and make note of the Wind phrase that results for the first period of each edit area.
  4. Change the "Wind" analysis method from "vectorMedianRange" to "vectorAvg" and run the product again. Did the phrases change?
  5. Change the "Wind" analysis method to "vectorModeratedMinMax" and run the product again. Did the phrases change?
  6. Override the "moderated_dict" (from the SampleAnalysis class) in your ZFP_<site>_Overrides file. Modify its values for Wind, re-run the product and notice any phrase changes that result.
  7. Change the temporal resolution for the Wind analysis from 6 hours to 3 hours and run the product again. To do this, change the [6] specification to [3] in the "Wind" analysisList entry. How did the phrases change?
Component Exercise 2: "Working with Analysis-Driven Weather Phrasing"
  1. Copy the "Period_1" product Component Method into the ZFP_<site>_Overrides file (if it is not already there).
  2. Make sure you have significant weather in the Wx grids for the first period for the edit areas over which the ZFP will run. Make at least 3 grids with varying weather conditions. Make at least one grid which does not end on a 3-hour boundary e.g. ending at 2 pm local time.
  3. Make sure the PoP for the first period is above 20.
  4. Run the ZFP and make note of the Weather phrase that results for the first period of each edit area.
  5. Change the temporal resolution for the Wx analysis from 6 hours to "[0]" (by grid). Did the phrases change?
  6. Change the temporal resolution for the Wx analysis to 12 hours and notice the resulting phrase changes.
Component Exercise 3: "Choosing an Alternate Phrase"
  1. Copy the "Period_1" product Component Method into the ZFP_<site>_Overrides file (if it is not already there).
  2. Run the ZFP and make note of the temperature phrases that result for the first period of each edit area.
  3. Look up the "highs_range_phrase" and "lows_range_phrase" in the SCALAR WEATHER ELEMENT phrase table.
  4. Comment out the "highs_phrase" and "lows_phrase" in the "Period_1" component and un-comment the "highs_range_phrase" and "lows_range_phrase".
  5. Re-run the ZFP and notice the difference in the temperature phrases.
Component Exercise 4: "Customizing a Phrase"
  1. Copy the "Period_1" product Component Method into the ZFP_<site>_Overrides file (if it is not already there).
  2. Choose a phrase and look up its entry in the Narrative Phrases tables under the appropriate Weather Element(s).
  3. Examine the list of Thresholds and Variables that apply to this phrase.
  4. Select several to override. For each,

Component Exercise 5: "Working with Basic Local Effects"

  1. Copy the "Period_1" product Component Method into the ZFP_<site>_Overrides file (if it is not already there).
  2. Set up a basic local effect for the wind_withGusts_phrase.

Configurable Issuance Exercises

Configurable Issuance Exercise 1: "Working with Configurable Issuance"

  1. Locate the "_10_503_issuance_list" in the AreaFcst standard file. Copy it into the ZFP_<site>_Overrides file (be sure to copy the ENTIRE method!)
  2. Locate the "narrativeDefAM" list of components and comment out all except the "Period_1" entry.
  3. Run the ZFP for the "Morning" issuance and notice that you will see only a Period 1 narrative. This is a handy way limit the product output when you are trouble-shooting or developing an enhancement.
  4. Locate the "Morning" label in the "return" statement list. Alter it and re-run the ZFP. Notice the dialog that appears has a new default label.
  5. For more information on the "issuance list" and it's entries, see the section: Narrative Definition and Configurable Issuance -- "def issuance_list"

Headline Exercises

Headline Exercise 1: "Generating Headlines"

  1. Create a Hazards grid with a duration within the first period to be covered by the ZFP.
  2. Set its value to "FL.W".
  3. Run the ZFP and note the headline that appears.
  4. Create Hazard grids of various durations over the 7-day forecast period.
  5. Run the ZFP and note the resulting headlines.

Headline Exercise 2: "Altering the allowedHazards"

  1. Find the "allowedHazards" list in the AreaFcst standard file.
  2. Copy the entire list into the ZFP_<site>_Overrides file and remove the entry for "FL.W".
  3. Create a Hazard grid with a value of "FL.W."
  4. Run the ZFP and note that the Flood Warning headline was not included.

Simple Tabular Products Exercises

Simple Tabular Products Exercise 1: "Creating a Weather Element by Area Table Product"

Create a new Table Product. Your table should show QPF, PoP and Wind across the columns and a set of default Edit Areas down the rows. Do not ask the user to specify the Edit Areas at run time. Instead, set them up in the table definition.

Answer to Simple Tabular Product Exercise 1

Simple Tabular Products Exercise 2: "Creating an Area By Period Table Product"

Create an "Area By Period" table to show Temperature for a set of Edit Areas at time period intervals. Let the user specify the Edit Areas and the time period interval at run time. Have the table generated beginning with the "Today" time range.

Answer to Simple Tabular Product Exercise 2

Smart Tabular Product Exercises

Smart Tabular Exercise 1: "Working with the SmartElementTable"

To see an example of a Smart Table Product which follows the Smart Text Product Template, we will study the SmartElementTable which can be found in the Define Text Products dialog IF you log on to the GFE as user GFETEST.  It consists of two files: SmartElementTable.py and SmartElementTable_Local.py. To activate the product, modify the Overrides file and un-comment the "displayName". Make sure you have defined edit areas named "area1", "area2", and "area3". Run the product so see the results.

Note the following in the standard SmartElementTable file:

  • VariableList: This allows the user to choose options at run-time. In this case, the user will specifiy whether a morning or afternoon product is desired.
  • Definition: This specifies the product type (smart), output file, edit areas and a product-specific regionList. The regionList maps the edit areas to regions by which the product results are grouped. Note that the "displayName" is set to None. This is because this file serves only as a base. The derived Overrides file will specify the "displayName."
  • TextProduct Class: This inherits from TextRules and SampleAnalysis classes.
  • generateForecast: This part of the code is identical to the Smart Text Product Template, following the same basic steps.
  • _getAnalysisList: This method (called by _getVariables) returns an analysisList that specifies the statistics desired for each weather element.
  • _getTimeRange: This method (called by _determineTimeRanges) is in the TimeRangeUtils module. Given the name of Time Range (defined in the GFE by Select Time Range), it returns a TimeRange object.
  • _getPeriods: This method (called by _determineTimeRanges) is in the TimeRangeUtils module. It returns a list of (timeRange, label) tuples given a timeRange, period, span, and optional labelMethod or labelFormat.
  • _getSampler: This method (called by _sampleData) is in the Interfaces module. It returns a HistoSampler object representing histograms from sampled data. The method is given an analysisList: (weather element, method) tuples, a timeRange list: (timeRange, label) tuples, and an editArea list: (editArea, label) tuples.
  • _getStatList: This method (called by _makeProduct) is in the Interfaces module. For each timeRange, it creates a statistics dictionary for a given list of weather elements and an edit area. The dictionaries are returned in a list which can then be used by the formatting methods to create the appropriate text strings.
  • _getTempValues and _getPopValues: These methods (called by _makeProduct) access the statList to create text string values. They use a TableBuilder method, _getScalarValue, which, given a numeric value, returns a text string
  • Note the following about the local SmartElementTable_Local file:
  • import SmartElementTable: This is necessary to have access to the standard class file.
  • Definition: The Definition section is copied from the standard file so that entries can be overriden to allow site-specific information such as output file and edit areas.
  • VariableList: This is not repeated here, but could be if the local site wanted something different from the one in the standard file.
  • TextProduct Class: Note that the local class inherits from the standard class (SmartElementTable) thus having access to all its methods as well as those in TextRules and SampleAnalysis. Therefore, to override any inherited method, the local class simply provides its own "def" method.
  • Make the following modifications in the SmartElementTable_Local file and test each as you go along:
  • Modify "outputFile" in the Definition
  • Modify the "defaultEditAreas" and "regionList" in the Definition
  • Copy the preProcessProduct method from the standard file and provide a product header.
  • Make note of the modifications you made and show an example of the revised output.
  • Change the "elementList" to include different combinations of Temp, PoP, and Humidity in various orders.
  • Smart Tabular Exercise 2: "Extending the SmartElementTable"

    Extend the SmartElementTable to have the capability of reporting Wind. You will have to: Answer to Smart Tabular Exercise 2

    Smart Tabular Exercise 3: "Working with the FWFTable"

    To see a more sophisticated example of a Smart Table Product, we will study the FWFTable. The Standard andOverrides files are FWFTable, FWFTable_<site>_Definition, and FWFTable_<site>_Overrides, respectively. Activate the FWFTable by setting it's "displayName" and Run the product.

    Note the use of the following inherited methods in the base FWFTable standard file:

  • getCurrentTime: This method (called by _preProcessProduct) is in the TimeDescriptor module. It will format the current time and return a text string.
  • getWeekDay: This method (called by _getLabel) is in the TimeDescriptor module. It is an all-purpose weekday labeling method which takes a time range as input and returns a text string label (e.g. Today, Tonight, Monday, etc). It can handle various combinations of upper and lower case, punctuation and holidays.
  • makeRow: This method (called by _makeProduct) is in the TableBuilder module. It is a general-purpose method for adding a row to a table. Arguments include: a row label, a column width, a statList and a formatting method with optional arguments.
  • getStats: This method (called by the text formatting methods) is in the Interfaces module. Given a statDict and a weather element name, it returns the corresponding statistics. If no data is available for the element, getStats returns "None". This should be tested in the text formatting method.
  • generateProduct: This method (called by _makeProduct) is in the Interfaces module. It can be used to "glue" another text product onto the current one. (It is similar to the "callSmartTool" command for Procedures.) In this case, we are generating and Extended Narrative product onto the tabular portion of the product. Notice the the Narrative Definition and Product Component Definitions for the Extended Narrative are included in the FWFTable standard file.
  • Make the following modifications to the FWFTable_<site>_Overrides file. Override portions of the FWFTable standard file if necessary. Make sure to comment changes that you make. Test each change as you go along:
  • Rearrange the order of the rows of the table by changing the order of the entries in the "_rowList."
  • Change the format of the current time reported in the product header.
  • Change the threshold values in the "_sky" method.  Insert a print statement in your method to verify that it has successfully overridden the one in the Standard file.
  • Notice that there is a "windAdjustmentFactor" in the Definition section. Wind reporting works as follows: If there is a Wind20ft grid available, that is used. If not, the Wind grid values are used after multiplying by the "windAdjustmentFactor" which has a default of .80. First, remove any Wind20ft grids that might be in the Today period. Run the product so that the Wind grid values are reported. Note the Wind values for the Today period. Now change the "windAdjustmentFactor" and run the product again. Note the change in the reported Wind values. Finally, create a Wind20ft grid in the Today period and assign values distinct from that in the Wind grid. Run the product again and verify that the Wind20ft values are now being reported.
  • Answer to Smart Tabular Exercise 3

    Smart Tabular Exercise 4: "Extending the FWFTable"

    Add a new row to the FWFTable for WindGust. Report a WindGust value only if the difference between the maximum WindGust and the maximum Wind value is greater than some configurable threshold. Use the "Wind20ft" weather element for Wind if available, otherwise, use and adjusted "Wind" weather element value. The adjusted value will simply be the Wind magnitude multiplied by the "windAdjustmentFactor". See if you can solve this problem without reading any further. If you get stuck, you can read on for some hints. Answer to Smart Tabular Exercise 4

    Narrative Product Exercises

    Narrative Exercise 1: "Accessing the Statistics Dictionary"

    In this exercise, you will practice accessing the Statistics Dictionary using the "tree.stats.get" command.
    1. Put the following code in your ZFP_<site>_Overrides file:

       def sky_setUp(self, tree, node):    
              if node.getComponentName() == "Period_1":
                  print "\n\nFrom Statistics Dictionary:"
                  tr = node.getTimeRange()
                  areaLabel = node.getAreaLabel()
                  stats = tree.stats.get("Wind", tr, areaLabel)
                  print "Wind List for ", tr,  areaLabel, stats
                  stats = tree.stats.get("Wind",  tr, areaLabel, mergeMethod = "MinMax")
                  print "Wind MinMax", stats
                  stats = tree.stats.get("Wind",  tr, areaLabel, mergeMethod = "Max")
                  print "Wind Max", stats
                  stats = tree.stats.get("Wind",  tr, areaLabel, statLabel="vectorMinMax")
                  print "Wind vectorMinMax", stats
                  print "\n\n"
              sky = self.ElementInfo("Sky", "List")
              elementInfoList = [sky]
              self.subPhraseSetUp(tree, node, elementInfoList, self.scalarConnector)                          
              return self.DONE()
         

    2. Run the ZFP with the default settings and examine the printed results in the terminal window. Examine the data to verify that the results are correct.
    3. Alter the "tree.stats.get" commands using various arguments and re-run the product. Satisfy yourself that that the results are correct.

    Narrative Exercise 2: "Narrative Tree Processing Rules"

    This exercise will illustrate the multiple-pass processing of the narrative tree by printing a trace of the methods executed and their return status.
    1. Bring up the GFE under userID GFETEST.  There you will find a Overrides file called "Phrase_Test_Local". Bring up the Formatter Launcher Dialog and run this product.
    2. Now we would like to turn on a trace for a phrase and follow it's progress. In the "phraseList" for Period_1, comment out all except the "weather_phrase". Now set the Wx grid for the first 12-hour period to Sct RW- and set the PoP to 60. Save your data to the Fcst database. Finally, uncomment the 'Definition["trace"] = 1' in the Definition section.  Now run the product using the Fcst database.
    3. You will see a trace in the terminal window similar to the following which has been annotated and bolded to help you read it:
    Local Formatter executed script:   runIFPText -t Phrase_Test_Local -g Phrase_Test -h dx3 -p 9581 -d BOU_GRID__Fcst_00000000_0000 -u GFETEST &
    Finding  Phrase_Test_Local
    Finding  Period_1
    Progress: 24% Sampling Data -- please wait...
    Time to Sample Data 3.3896099329
    Progress: 72% Analyzing Data -- please wait...
    Time to Get Statistics 1.95773291588
    Progress: 50% Making Product for Area 1
    Finding  Headlines
    Finding  Headlines
    Progress: 24% Sampling Data -- please wait...

    Time to Sample Data 0.956331014633
    Progress: 72% Analyzing Data -- please wait...
    Time to Get Statistics 0.00587105751038
    Time for phrase generation for  Area 1 : 0.00755608081818 Passes 5
     

    Pass 1:
    Traversing node: None Area 1 (
    Sep 25 03 12:00:00 GMT, Sep 26 03 00:00:00 GMT)
    Method assembleChildWords  6.29425048828e-05       Words None
    Traversing node: Period_1 Area 1 (Sep 25 03 12:00:00 GMT, Sep 26 03 00:00:00 GMT)
    Method assemblePhrases  5.49554824829e-05       Words None
    Method wordWrap  0.000158905982971       Words None
    Traversing node: weather_phrase Area 1 (Sep 25 03 12:00:00 GMT, Sep 26 03 00:00:00 GMT)
    Method weather_setUp DONE 0.00276303291321       Words None
    Method combinePhraseStats DONE 7.09295272827e-05       Words None
    Method consolidateWx DONE 0.000249028205872       Words None
    Method separateNonPrecip DONE 0.000325083732605       Words None
    Method recallCombinePhraseStats DONE 6.30617141724e-05       Words None
    Method consolidateVisibility DONE 7.89165496826e-05       Words None
    Method combineWords DONE 5.00679016113e-05       Words None
    Method fillNulls  0.000177979469299       Words None
    Method timeDescriptorModeration  6.79492950439e-05       Words None
    Method assembleSubPhrases  6.40153884888e-05       Words None
    Method postProcessPhrase  5.10215759277e-05       Words None
    Traversing node: None Area 1 (Sep 25 03 12:00:00 GMT, Sep 26 03 00:00:00 GMT)
    Method weather_words DONE 0.00634896755219       Words scattered rain showers
     

    Pass 2:
    Traversing node: None Area 1 
    (Sep 25 03 12:00:00 GMT, Sep 26 03 00:00:00 GMT)
    Method assembleChildWords  5.69820404053e-05       Words None
    Traversing node: Period_1 Area 1 (Sep 25 03 12:00:00 GMT, Sep 26 03 00:00:00 GMT)
    Method assemblePhrases  5.69820404053e-05       Words None
    Method wordWrap  4.39882278442e-05       Words None
    Traversing node: weather_phrase Area 1(Sep 25 03 12:00:00 GMT, Sep 26 03 00:00:00 GMT)
    Method fillNulls DONE 0.000213980674744       Words None
    Method timeDescriptorModeration DONE 0.0001380443573       Words None
    Method assembleSubPhrases DONE 0.000234007835388       Words scattered rain showers
    Method postProcessPhrase DONE 0.000167012214661       Words scattered rain showers
    Traversing node: None Area 1 (Sep 25 03 12:00:00 GMT, Sep 26 03 00:00:00 GMT)
     

    Pass 3:
    Traversing node: None Area 1 
    (Sep 25 03 12:00:00 GMT, Sep 26 03 00:00:00 GMT)
    Method assembleChildWords  5.49554824829e-05       Words None
    Traversing node: Period_1 Area 1 (Sep 25 03 12:00:00 GMT, Sep 26 03 00:00:00 GMT)
    Method assemblePhrases DONE 0.000898003578186       Words .TODAY...Scattered rain showers.
    Method wordWrap DONE 0.000109076499939       Words .TODAY...Scattered rain showers.

    Traversing node: weather_phrase Area 1 (Sep 25 03 12:00:00 GMT, Sep 26 03 00:00:00 GMT)
    Traversing node: None Area 1 (Sep 25 03 12:00:00 GMT, Sep 26 03 00:00:00 GMT)
     

    Pass 4:
    Traversing node: None Area 1
    (Sep 25 03 12:00:00 GMT, Sep 26 03 00:00:00 GMT)
    Method assembleChildWords DONE 0.000106930732727       Words .TODAY...Scattered rain showers.

    Traversing node: Period_1 Area 1 (Sep 25 03 12:00:00 GMT, Sep 26 03 00:00:00 GMT)
    Traversing node: weather_phrase Area 1 (Sep 25 03 12:00:00 GMT, Sep 26 03 00:00:00 GMT)
    Traversing node: None Area 1 (Sep 25 03 12:00:00 GMT, Sep 26 03 00:00:00 GMT)
     

    Pass 5:
    Traversing node: None Area 1 
    (Sep 25 03 12:00:00 GMT, Sep 26 03 00:00:00 GMT)
    Traversing node: Period_1 Area 1 (Sep 25 03 12:00:00 GMT, Sep 26 03 00:00:00 GMT)
    Traversing node: weather_phrase Area 1 (Sep 25 03 12:00:00 GMT, Sep 26 03 00:00:00 GMT)
    Traversing node: None Area 1 (Sep 25 03 12:00:00 GMT, Sep 26 03 00:00:00 GMT)
    Time for phrase generation for  Area 1 : 0.0191469192505 Passes 5
    Progress: 100% Phrase_Test Complete
     

    There are five passes through the tree to construct the weather phrase.

    Narrative Exercise 3: "Working with 'Phrase_Test_Local'"

    In this exercise, you will work with Phrase_Test_Local to understand the Narrative Phrases and Strategies. From the GFE Help menu, select "Test Cases" and find "tp003: Narrative Phrases Test Cases and Tutorial". Follow the instructions for setting up and testing the Phrase_Test_Local file located under the GFETEST userID.

    Narrative Exercise 4: "Working with 'Local_Effects_Test_Local'"

    In this exercise, you will learn about different ways to set up local effects. From the GFE Help menu, select "Test Cases" and find "tp004: Local Effects Test Cases and Tutorial". Follow the instructions for setting up and testing the the Local_Effects_Test_Local file located under the GFETEST userID.

    Phrase Exercises

    Phrase Exercise 1: "Overriding a Word Method"

    In this exercise, you will see how to override a Word Method in order to alter the wording a phrase. You will see that although the na
    1. In the ZFP_<site>_Overrides file, override the "snow_words" method (ScalarPhrases).
    2. Change the wording to use a dash instead of the word, "to".  For example, "1 to 2 inches" will come out as "1-2" inches.
    Answer to Phrase Exercise 1

    Phrase Builder Exercise 2: "Inter-phrase Dependency"

    In this exercise, you will learn how to use the resulting words from one phrase to affect the words of another phrase. For example, the PoP phrase wording will depend on the type of weather occuring in the period.
    1. Examine the "popMax_words" method from ScalarPhrases. Notice the "findWords" method that finds the words for the weather_phrase. Since the popMax_phrase is dependent on the weather_phrase, it does not execute until the weather_phrase words have been set.
    2. In the Phrase_Test_Local file, override the "popMax_words" and insert a print statement as follows:        
                
              wxWords = ""
              if self.wxQualifiedPoP_flag(tree, node) == 1:
                  wxWords = self.findWords(tree, node, "Wx", node.getAreaLabel())
                  print "wxWords", wxWords
                  if wxWords is None:
                      return
                  if wxWords == "":
                      return self.setWords(node, "null")
                 
    3. Run the product and examine the results in the terminal window. Can you explain them?

    Phrase Exercise 3: "Phrase Anatomy"

    In this exercise, you will gain an understanding of each phrase method and see how they all work together to form the resulting phrase.
    1. In the Phrase_Test_Local file,  comment out all phrases EXCEPT the wind_withGusts_phrase in the Period_1 product component.
    2. Override the "standard_vector_phraseMethods" from VectorRelatedPhrases.
    3. Set up one Wind grid and no WindGust grid for the first period.
    4. For each phraseMethod in turn (including the setUp and wordMethods), comment it out and run the product. Can you explain the results?
    5. Set up two differing 6-hour Wind grids and repeat Step 4.
    6. Set up one WindGust grid with a non-null value and repeat Step 4.
    7. Finally, set up two differing 6-hour WindGust grids and repeat Step 4.
    8. At each step, see if you can understand the phrase and/or error message results.
    9. Continue to experiment with different data values and phraseMethod combinations to gain insight into phrase building..
    10. Comment out all phrases EXCEPT the weather_phrase in the Period_1 product component.
    11. Override the "standard_weather_phraseMethods" from WxPhrases.
    12. Set up one Wx grid with significant weather for the first period. Make sure the corresponding PoP grid is set to at least 20.
    13. For each phraseMethod in turn (including the setUp and wordMethods), comment it out and run the product. Can you explain the results?
    14. Set up two differing 6-hour Wx grids and repeat Step 4.
    15. Continue to experiment with different data values and phraseMethod combinations to gain insight into phrase building.

    Phrase Exercise 4: "Adding a New Phrase"

    In this exercise, you will add a QPF  phrase to Period_1 for the ZFP product. 
    1. Create a new phrase for QPF and add it to the ZFP product.  Use the popMax_phrase as a starting point. For simplicity, report the QPF value as an integer.
    Try this exercise without reading further. If you need some more hints, read on.
    1. Use the "accumSum" or "accumMinMax" analysis method. Make sure your phrase can handle either.
    2. Add the phrase name to the Period_1 component definition.
    3. Make sure you have included an entry for QPF in the phrase_descriptor_dict.
    Answer to Phrase Exercise 4

    Trouble-shooting Exercises

    Trouble Exercise 1: "Simple Error Message"

    In this exercise, you will look up an error message in the Trouble-shooting section to isolate the problem.
    1. Open the Combinations file in the Define Text Products dialog. Replace "area1" with "area15".
    2. Run the ZFP product.
    3. Check the terminal window for error messages. You should see a stack trace.
    4. Look in the Trouble-shooting page and find the description for this error.
    5. Make the correction and run the product again.

    Trouble Exercise 2: "Revert to Baseline"

    In this exercise, you will follow the Trouble-shooting Strategy to isolate and fix a problem with a formatter.
    1. Run the product with displayName appearing as "TroubleEx2".
    2. Use the Trouble-shooting Strategy 3 to isolate and fix the problem.

    Trouble Exercise 3: "Scavenger Hunt"

    In this exercise, you will follow the Trouble-shooting Strategy to isolate an infinite loop in processing the narrative tree.
    1. Ask a buddy to set up this exercise by doing steps 2-7. Then do step 8.
    2. In the Text Utilities Window, create a file named "TroubleEx3". Remove the template code and create a new class:
      class TextProduct:
    3. Choose a wordMethod from one of the phrase definitions in Period_1 of the AreaFcst product.
    4. Change the last "setWords" call to a simple "return" statement. Copy it into the TextProduct class in the TroubleEx3 file. Save and close the file.
    5. Open the ZFP_<site>_Overrides. Comment out the "class" declaration and replace it with the following:

       import TroubleEx3
       class TextProduct(TroubleEx3.TextProduct, AreaFcst.TextProduct):
          Definition = copy.deepcopy(AreaFcst.TextProduct.Definition)

    6. Run the ZFP and make sure that the product returns an error message instead of text. If not, change the data or the TroubleEx3 file to make sure an error occurs.
    7. Save and close the file and return to your seat.
    8. Run the ZFP.  Use Trouble-shooting Strategy 4 to isolate the problem. See how far you can get WITHOUT looking at TroubleEx3!