The edit area generation software uses the maps database tables as input. These tables are populated by importing shape files provided by the National Weather Service. These tables are filtered by domain (based on the site) and attributes. There are different attributes available for each table. Refer to the AWIPS Map Background Database provided by the National Weather Service for details on the available shapefiles and the attributes contained within each shapefile. This information will be needed in order to tailor edit area generation for your site.
The user can select which polygons will be converted into edit areas and to which edit area groups they will be assigned.
This information is provided for you to help you understand the format of Maps.py. You should NEVER change the original Maps.py since your changes will be overwritten with the next upgrade. See the server configuration overview for information on how to make changes that are supported to the map backgrounds.
To override definitions in Maps.py, use the localMaps.py technique.
To update the maps database, refer to the MapFiles documentation, specifically the section on Updating Shapefiles.
Software releases after Jan 1, 2006 separate the map shapefile from the
CORE GFE. In some applications, such as AWIPS, the map
shapefile configuration becomes the responsibility of the site since
the map shapefiles will no longer be shipped with the GFE
software. A separate install is available for non-AWIPS
purposes and is posted with the software releases. If the
associated Map Shapefile is not installed at your site, then
sites will be responsible for:
CWA = siteConfig.GFESUITE_SITEID
CWAzones = ShapeTable('zone') CWAzones.name = CWA + '_zones' CWAzones.editAreaName = ['state','zone']The ifpServer can automatically generate edit areas based on the information in the shapefiles. The user specifies the "editAreaName" in the Maps.py or localMaps.py files, and the ifpServer uses that information to determine the name of each edit area. There are three forms to the editAreaName line as shown:
mapVariable.editAreaName =
"string" |
Single String Format |
mapVariable.editAreaName =
["string1", "string2", "string3"] |
List of Strings Format |
mapVariable.editAreaName =
functionName |
Function Format |
CWAzones = ShapeTable('zone') CWAzones.name = CWA + '_zones' CWAzones.editAreaName = 'zone'
Examples of the names of the edit areas generated from the above
snippet
is shown in the following table:
zone value from shapefile | state (not used in this example) | Name of Edit Area |
034 | CO | zone034 |
041 | CO | zone041 |
041 | NE | zone041 |
Note that if a site's domain covers more than one state, this simple form of generating edit area names will not work. The "NE" example above illustrates that the same edit area name was generated even though the zones were from different states. Also note that the naming of the edit area includes the name "zone" only because the value of the zone value begins with a number.
NOTE:
Changing the default set of edit area names as supplied in the baseline
may render your text formatters and VTEC inoperable. The text
formatters and VTEC assume standard UGC-named edit areas, such as
COZ023 and UTC013.
A second, more complex form of the editAreaName involves using a Python list. The naming of an edit area is determined by using more than one attribute. This example uses the more complex form for the editAreaName, in which two attributes are specified.
CWAzones = ShapeTable('zone') CWAzones.name = CWA + '_zones' CWAzones.editAreaName = ['state','zone']
Examples of the names of the edit areas generated from the above
snippet
is shown in the following table:
zone value from shapefile | state (not used in this example) | Name of Edit Area |
034 | CO | CO_034 |
041 | CO | CO_041 |
041 | NE | NE_041 |
The edit area name is determined from the value of the state attribute, followed by an underscore character, and then the value of the zone attribute.
Here is the software algorithm for naming of edit areas:
editAreaName string | Name of Edit Area |
'zone' | zone034 |
['zone','state'] | zone034_CO |
['state','zone'] | CO_034 |
['wfo','name'] | BOU_SummitCountyMosquitoRangeIndianPeaks |
['zone','name','state'] | zone034_SummitCountyMosquitoRangeIndianPeaks_CO |
Note that specification of an attribute that doesn't exist will simply use the name in the string. For example, if you are creating edit areas and you want them of the form ISC_xxx, where xxx is the value of the wfo attribute. The editAreaName string would be the following:
ISCareas.editAreaName = ['ISC', 'wfo']
NOTE: Changing the default set of edit area names as supplied in the baseline may render your text formatters and VTEC inoperable. The text formatters and VTEC assume standard UGC-named edit areas, such as COZ023 and UTC013.
Occasionally there is a need to calculate a special edit area name and the single or list of strings methods are not sufficient. The function format requires the user to name a function and then define a function. The function has one argument, which receives a dictionary of attribute names and their values. The return value of the function is a string which becomes the edit area name.
For example, lets say that we want edit area names based on the county FIPS code. The desired format is stateCfips, such as COC013, for Colorado County #13. The county shapefile has a 'STATE' attribute, such as "CO", and it has a 'FIPS' attribute, such as 08013 for Colorado County #13. Using the list of strings format, ['STATE', 'C', 'FIPS'], you would end up with CO_C_08013, when we really want COC013.
This is how the code would be implemented:def cwaEAN(atts): fips = atts['fips'][-3:] #take the last three characters from the FIPS code s = atts['state'] + "C" + fips #assemble the name return s #return the complete edit area name CWAcounties = ShapeTable('county') CWAcounties.name = CWA + '_counties' CWAcounties.editAreaName = cwaEANThe "atts" dictionary looks simlilar to the following:
{'countyname': 'Delta', 'cwa': 'MQT' 'fe_area': 'sr', 'fips': '26041', 'lat': 45.82085, 'lon': -86.909679999999994, 'state': 'MI', 'time_zone': 'E', }and the final string is: MIC041
CWAzones = ShapeTable('zone') CWAzones.name = CWA + '_zones' CWAzones.editAreaName = 'zone' CWAzones.groupName = 'Zones'
pythonMapName.filter(lambda x : x['ATTRIBUTENAME'] = AttributeValue)
where ATTRIBUTENAME is one of the attributes in the shapefile, and AttributeValue is the value that must match in the shapefile for this shape to be kept in the map. Attributes for the NWS shapefiles can be obtained from the AWIPS Map Catalog AWIPS Map Background Database.
CWAzones = ShapeTable('Zone') CWAzones.name = CWA + '_zones' CWAzones.filter(lambda x : x['cwa'] == CWA) CWAzones.editAreaName = cwazones
The "lambda" function is a shortcut method of writing a function, the code snippet below performs the identical function:
def cwaZoneFilt(x): return x['cwa'] == CWA CWAzones = ShapeTable('zone') CWAzones.name = CWA + '_zones' CWAzones.filter(cwaZoneFilt) CWAzones.editAreaName = cwazones
Since this is all Python code, there is another technique you can use to write a filter function which is complex. Here is an example of writing a filter that selects certain counties (Summit, Sandusky, Huron, and Medina) from the county database table for a particular state (Ohio) and cwa (Cleveland):
def exampleFilt(x): myCounties = ['Summit', 'Sandusky', 'Huron', 'Medina'] return x['countyname'] in myCounties and x['st'] == "OH" and x['cwa'] = 'CLE' OHcounties = ShapeTable('county') OHcounties.name = 'ExampleOHCounties' OHcounties.filter(exampleFilt) OHcounties.editAreaName = 'countyname'
CWAzones = ShapeTable('zone') CWAzones.name = CWA + '_zones' CWAzones.filter(lambda x : x['cwa'] == CWA) CWAzones.editAreaName = ['state','zone'] CWAzones.groupName = 'Zones'
maps = [ CWAcounties, Counties, CWAzones ]
# import the local maps file try: import localMaps except: pass