3.3. Runing the Test Cases for Using Scripts

Scripts are provided for Unix users to exercise most of the major functions of the software. If you cd into the scripts directory, all of the scripts should run without any editing. However, if you wish to run any of the scripts without first cd-ing into the scripts directory, edit the SA_HOME setting for all of the scripts in the directory (e.g., generate_surrogates.csh, compare_surrogates.csh) to specify the full path to your installation folder.

A set of example scripts is provided with the software to assist users with getting started using the system. These example scripts are provided only to serve as examples - the user is responsible for providing actual input data for his/her application and customizing the scripts accordingly. The example scripts generate a set of surrogates for an 8-km grid over Nashville, Tennessee. The input files for the examples are available from the Spatial Allocator Download Site. These files were derived from files available from the EPA ftp://ftp.epa.gov/EmisInventory/emiss_shp2003/. Some of the files are used as is, while others are extracted for Tennessee from the larger national data sets due to their size. The only file that was not from this web site is the cnty_tn shapefile that contains the polygons for the counties of Tennessee. This file was obtained from an independent source of county data.

The following surrogates are generated in the examples:

  1. Airports
  2. Land Area
  3. Ports
  4. Navigable Water
  5. Major Highways
  6. Housing
  7. Population

NOTE that these are examples only and should not be considered a complete set of surrogates with which to do emissions modeling! However, a complete set of input files to reproduce EPA's 66 surrogates using the Surrogate Tool is available with the Surrogate Tool distribution.

The following are a few test scripts included in the release:

Generate Emission Spatial Surrogates from Shapefiles and Compare to Reference Surrogates

  1. To test the basic operation of the surrogate creation program (i.e., generating surrogates for point, line, and polygon datasets), run the generate_surrogates.csh script. This will generate a set of test surrogates in the output directory, in addition to some gridded shapefiles that can be viewed in a GIS tool. Note that some warnings will be generated for counties on the edge of the grid since some of their surrogates will not sum to 1. 
     
  2. Run the compare_surrogates.csh script to compare your surrogates with the reference surrogates. Note that compare_surrogates uses the diffsurr.exe utility to compare two sets of surrogates with respect to a specified tolerance. You may find the diffsurr.exe utility useful, for example, when you are creating new surrogates and would like to compare them to the previous versions. Diffsurr takes its arguments from the command line. An example of its usage follows; note that 3 is the numeric ID for the surrogates in the two files (i.e., both surrogates are numbered 3 in this case), although that may not always be true.
    
        diffsurr.exe ../data/srg_nash_ref.txt 3 ../output/my_srgs.txt 3 0.00001
    
        
  3. Examine the outputs of the program in the output directory.

Generate a Filtered Surrogate

Generate a Surrogate Using a Weight Function

 

Change Map Projection of a Shapefile

  1. To see how to change the map projection of a Shapefile using the CONVERT_SHAPE mode of the allocator program run the convert_input_shape.csh script as follows:
    convert_input_shape.csh ../data/tn_ports ../output/tn_ports_ll

    The new tn_ports_ll file will have coordinates in a latitude-longitude map projection. The tn_ports_ll file should be easily visualizable by GIS tools. Note that the ports gridded shapefile will not have a nonzero value in each grid cell that has a port because BERTHS was used as the weight and many ports in the weight file have a value of 0 for the BERTHS attribute. To make all grid cells with ports nonzero, use NONE as the value for the WEIGHT_ATTR_LIST when creating the ports surrogate.


  2. (Optional) If you require a mapping tool for shapefiles (e.g., for quality assurance of surrogates), you may want to consider ArcExplorer by ESRI, which is downloadable for free from the ESRI web site (http://www.esri.com).
     

Filter a Shapefile

Convert Files

Generate BELD3 Data for Biogenic Emissions Processing and Compare Two I/O API Files

Allocation data attributes from a grid, polygon, or point file to an output grid or polygon file


To Section 3.3: Environment Variables Used by the Software