Enter a ZIP code to get a forecast:
Setup Location

WRN Logo

WXP Resources 1

What are Resources?

Resources are used to set parameters for WXP programs. Each WXP program has a list of resources that can be used to change input file parameters to output graphics characteristics.  Each resources has a default value compiled into the program. Some of these resources default to a user prompt often with a menu of possible values.  

You could just prompt the user for all of the resources but some WXP programs have over 30 available resources. This would make it to difficult to run the program.  As a result, many of the resources are not visible (menus or prompts) but can be set either on the command line, through environment variables or with the resource file.

What are some typical Resources?

WXP has over 50 resources available.  Each resource has a resource name and a value which can either be a number, string or a list of values separated by commas.  Here is a list of typical resources used in WXP and a brief explanation of what information they contain:

File Resources

  • name_conv - This defines the file which stores the naming convention information for WXP.  Every file WXP uses must adhere to a specific name convention which how date and time information are contained in the file name.  For example, /noaaport/nwstg/convert/01062023_sao.wxp is a file name.  The name convention specifies /noaaport/nwstg/convert/ as the path, 01 as the year (2001), 06 as the month (June), 20 as the day, 23 as the hour and sao.wxp as the extension defining the file as surface data in WXP converted data.
  • file_path - This defines the path to locate all WXP database files including city databases (define station locations) and map databases.
  • data_path - This defines the path to locate all raw encoded data from the Family of Services. Generally, the decoders and parsers use this resource but it is also used for locating MOS data and some of the model gridpoint data.
  • con_path - This defines the path to locate all decoded/converted data files.  The WXP decoders will read data in from the data_path and place their output in the con_path directory. Most WXP analysis programs then read from this directory
  • file_param - This resource controls how data files are handled.  If the file exists, should you overwrite it or append to it.
  • in_file - Defines what type of files are going to be used as input into the program. This resource is used to define the input file format as well as the naming convention.
  • out_file - Defines the type of output files.  For some programs such as decoders, this defines the output file format as well as the naming convention.  For others, it specifies whether the program will produce output or not.
  • filename - This specifies the actual filename to be used by a program.

Date Resources

  • current - This defines which data files is to be used based on the current time.  You can specify to use the latest file or a file which is X number of hours old.
  • hour - This limits the current resource to specific hour during the day.  This would be used if you want the latest 12Z file.
  • num_hour - This specifies how many data files to use.  In parsing programs, this extends the search for data to more than one data file.  In display programs, this specifies the number of hours to loop through.

Data Analysis Parameters

  • plot_domain - This specifies the domain and projection of the final plot.  There are several projections available in WXP which are discussed in more detail in the Users Guide.  The plot domain can be a predefined region that can be referenced by an abbreviation such as "us".
  • time - This specifies the forecast time to be used in programs that deal with forecast products.
  • level - This specifies the vertical level or layer to be used in the program.
  • variable - The variable or parameter to plot.
  • identifier - This specifies a list of specific station identifier to use.
  • stat_prior - Determines the priority level of the stations to be used.  The higher the number, the more stations will be used.
  • parameter - Some general parameters used in non-graphical programs.

Database Parameters

  • city_file - This lists the city database file to be used to locate station data.  
  • map_file - This lists the map files to be used in creating the geographical background maps.

Plotting Parameters

  • plot_type - Specifies the type of output plot
  • draw - Defines which parts of the plot are to be drawn such as map, text labels and the plotted data itself..  This is handy for overlays where certain parts of the plot may overlap another.
  • con_interval - Specifies the interval to be used in plotting and contouring data.
  • con_base - Specifies the base value to be used for contours.
  • plot_scale - The scale factor to be used in plotting the data.
  • plot_parameter - Specifies a list of additional plotting and anaysis parameters.
  • font_list - Lists the fonts to be used in the plots
  • color_table - Specifies a file which contains a list of color that will be used in the plots

Attribute/Color Parameters

  • color_text - Specifies the colors/attributes of the text labels drawn above and below the plot.
  • color_map - Specifies the colors/attributes of the base map used in most programs.
  • color_data - Specifies the colors/attributes of plotted data.
  • color_cont - Specifies the colors/attributes of the line contours.
  • color_fill - Specifies the colors/attributes of the color fill contours.

Device/Window Parameters

  • device - Specifies the output device type and parameters.
  • geometry - Specifies the geometry of the window or output plot.
  • title - Specifies the title to use on the window.
  • background - Specifies the background color to be used in the plot

Miscellaneous Parameters

  • help - Provides help for each program
  • message - This specifies the message level.  This is handy in either reducing the amount of text output from a program or increasing it for informative purposes.

How to set WXP Resources

WXP has several methods for accessing and modifying resources. Not every resource is called into a WXP program.  For example, a decoder won't need color resources so it is set up to ignore these resources even if they are modified.  We will now discuss each method in a bit more detail:

WXP Program Defaults

Each WXP program sets a default value for each of the resources that program needs.   These are hardcoded into the program but often these are modified.  For example, the data_path resource defaults to the current directory.  Of course you would rarely store data in the current working directory so this resource is usually set to some other value.  Some program defaults, allow the user to enter the value of the resource through a menu and prompt.  An example of this is the plot_domain resource.  As we saw in the previous tutorial, this resource is usually left to a user prompt and a menu of possible choices is display.  

WXP Resource File

Resources that rarely change should be listed in the resource file.  This file essentially contains WXP's default settings.  The file can contain both global as well as program specific resource values.  Generally, at the top of the resource file are all global resource values.  An example of a global resource is:

   *data_path: /noaaport/nwstg/data

If a resource needs to be specifically set for a program, you can place the program name in place of the asterisk:

   grbcalc.data_path: /noaaport/nwstg/model

There are also named resources where a name is used in place of the program:

   nids.data_path: /noaaport/nwstg/nids

The concept of a named resource will be discussed later.

The default resource file is .wxpdef (wxp.def for DOS/Windows).   The default location is the current working directory.  If this file is located in a different directory, the directory must be listed in the wxpdefault environment variable:

   setenv wxpdefault /home/wxp/etc

This is usually set up by the system administator and added to your shell initialization script.

NOTE: WXP uses a license file whose location is dependent on the file_path resource.  If this is not set, you may get "invalid license to use WXP".

Environment Variables

WXP offers a complete set of environment variables for setting WXP resources.  In general, these will be used to set resources that will have the same value over a WXP session.  A good example of this is if you want to use the latest available file for every program.  To do this, you set the environment variable associated with the current resource. The name of the environment variable is just "wxp" + the resource name.  So the current resource has an associated environment variable named "wxpcurrent".  Now returning to the example, you would set the environment variable as such:

   setenv wxpcurrent la

which is the way to specify the latest (la) available.  Now each WXP program will use the latest file and it won't prompt you for the file name.

All WXP resources have named environment variables as well.  This works just like the resource file by specifying "wxp" + program name + "." + resource.  So if you want color_data resource for only uacalplt to be red, then you would specify:

   setenv wxpuacalplt.color_data red

Environment variables can be unset at any time to return WXP to its default setup:

   unsetenv wxpuacalplt.color_data

So this makes a convenient mechanism for setting temporary values. The other place that environment values are useful are in scripts, which will be discussed later.  If these settings are used often, you may want to add them to the resource file as named resources.

Command Line

As expected, each resource can be specified on the command line.  Most WXP programs will prompt the user for critical information needed to run the program. But prompting for everything would make WXP impossible to use.  Thus command line parameters/resource offer additional tailoring capabilities.  Command line resources only affect the WXP program that you are invoking. If you want resources to carry over to other WXP programs, consider using environment variables.  Using environment variables for common resources will often reduce the number of resources you need to specify on the command line.

The syntax for the command line is very similar to the to that for other methods.  Most of the WXP resources are keyed resources.  This means that the resource must be listed first and then the value.  To specify that the resource is a keyed resource, the resource name is preceded by a "-".  The syntax is "-" + resource name + "=" (optional) + its value.

   sfcwx -plot_domain=at

In many cases it would be nice to not list the entire resource name in the key.  WXP provides two shortcuts.  First, each resource has a 2 (sometimes 3) letter abbreviation associated with it.  Here is a sample list of abbreviations:

Resource Abbr Resource Abbr Resource Abbr Resource Abbr
name_conv nc file_path fp data_path dp con_path cp
grid_path gp raw_path rp file_param pf in_file if
out_file of current cu num_hour nh hour ho
decode_hour dh plot_domain pd region re time ft
level le variable va identifier id stat_prior pr
object_param oa parameter pa city_file cf map_file mf
plot_type pl draw dr con_interval in con_base cb
plot_scale sc plot_param pp font_list fl color_table ct
color_text cot color_map com color_cmap cocm color_line coln
color_data cod color_wind cowd color_cloud cocd color_cont coco
color_fill cof color_front cofr device de geometry ge
title ti icon ic background bg default df
name na help h batch ba message me
Command Line Resource Abbreviations

So to simplify the plot_domain resource, you need to only specify:

   sfcwx -pd=at

The term keyed resource means that since each value is keyed, many resources can be set, each with its key and entered onto the command line in any order.  For example:

   sfcwx -de=d -pd=us -me=none -va=all -ti=US_PLOT -cu=la

This will plot a surface map with:

  • device output is the display "d"
  • the plot domain is the contiguous United States "us"
  • the message level is "none" which means all print statements will be disabled cleaning up run for scripting
  • the plot variable is "all" which is a station model (temperature, dewpoint, clouds, wind barb and pressure)
  • the window title is "US_PLOT"
  • the latest "la" will be used

Most WXP programs allow positional (non-keyed) resources.  In most cases, this is the filename resource.  A positional parameter does not need to have the resource specified and ONLY its value is listed:

   sfcwx 01062022

Some programs like wxploop allow you to specify more than one file:

   wxploop sfc1.gif sfc2.gif sfc3.gif sfc4.gif

The term positional means that they are order dependent.  For wxploop, it uses this list of files to load GIF images into the program for animation or looping.  They are loaded in the order they appear.

Keyed and Positional resources can be intermixed on the command line:

   sfcwx -re=us -va=all 01062022 -de=d -me=none -ti=US_PLOT

In this case, we use the positional file parameter instead of the current resource (-cu=la). 

NOTE: Keyed resources can be listed more than once on a command line.  The LAST occurrence of a keyed resource is the value taken.  All other occurrences are ignored.

To get help on available resources, you can specify the help resource:

   % sfcwx -help
   sfcwx: This program plots various types of surface data
   sfcwx syntax (version:5.0-X11)
      sfcwx [options...]
   Keyed options...
    -df file    Resource/defaults file name
    -na name    Program name
    -h          Print this help
    -ba         Run program in batch mode
    -me level   Message level to be displayed:
    -ic         Open window iconified
    -bg clr     Background color
    -ge wxh+x+y  Window geometry
   Positional options...
    file        Input file name

Program Prompts

Many WXP programs prompt the user for data.  Every prompt is a request for a resource value.  In some cases, you will enter the exact value for the resource as in a filename.

   List of available files:

   Enter the surface filename: 01062022

In most menu/option prompts, shorthands can be used.  For example, the filename can be entered as the full path "/noaaport/nwstg/convert/01062022_sao.wxp", the name of the file "01062022_sao.wxp" or just the date portion of the file "01062022".  WXP handles putting the extension and the path on the filename if not specified.

In other cases, a menu will appear.  Each menu item has a resource value associated with it.  By entering the number from the menu, you are essentially entering that value.  It is just an abbreviation for the value.

           Region Menu

     1: Contiguous US                   --------------------               
     2: New England                     10: Western Canada                
     3: Atlantic                        11: Eastern Canada                
     4: Southeastern                    12: Northern Canada               
     5: Midwestern                      13: North America                 
     6: Southern Plains                 14: Indiana                       
     7: Northwestern                    15: Lafayette                     
     8: Southwestern                  
     0: Return to previous menu         -1: Exit program                  

   Enter the region: 3

As with the file prompt, there are several ways of entering data at a menu prompt.  First, you can enter the number associated with the selection.  For example, I want the Atlantic region, I would pick "3".  Second, there is the menu listing.  You could have entered "Midwestern".  There is also the resource value.  To get a list of possible resource values, you can type "?" at the menu prompt:

   Enter the region: ?

The values are then listed and the prompt returns.  You can see that the associated value is "mw" so this could have been entered as well.  There are a number of preset regions that don't show up on the menu because of space concerns.  To get a full list of predefined regions, use the "list" command:

   Enter the region: list
    Abbr    Description
   us       Contiguous US                                     
   us2      Contiguous US 2x                                    
   ne       New England                                       
   at       Atlantic                                          
   ngm1     NGM                                               
   namere   North America Ext                                 
   nhem     North Hemisphere                                  
   shem     South Hemisphere                                  
   hi       Hawaii                                            
   ak       Alaska                                            
   ind      Indiana                                           
   laf      Lafayette                                         
   globe    Global
   europe   Europe
   easia    East Asia                                           
   aust     Australia                                         
   wpac     West Pacific                                      
   antarc   Antarctica                                        

Often the values are short and mostly easy to remember. As you get more adept at using WXP, you will rarely look at the menu but will almost always enter the resource value.

Finally, there are non-menu resource values that can be selected.  For the region menu, a full plot domain value can be entered.  This really generalizes the use of menus to being interfaces into setting the resource:

   Enter the region: lc,40,-105,1.4

Here, the values represent the projection (optional), central latitude, longitude and the scale size of the plot (1 is appropriate for regional plots).  

For the variable regions, the non-menu values encompass a whole list of variables WXP can calculate.  Each program has a predefined set of parameters either defined within the program or through a variable file:

           Variable Menu

     1: All Data                        13: Cloud Cover                   
     2: Temperature                     14: Pressure Tendency             
     3: Dewpoint                        15: 24 Hr Precip                  
     4: Wind Direction                  16: 24 Hr Maximum Temp            
     5: Wind Speed                      17: 24 Hr Minimum Temp            
     6: Wind Gust                       18: Snow Depth                    
     7: Wind Barb                       19: Wind Chill Temp               
     8: Sea Level Pressure              20: Heat Index                    
     9: Altimeter Setting               21: Relative Humidity             
    10: Present Weather                 22: Equiv Potential Temp          
    11: Visibility                      23: Convergence                   
    12: Cloud Ceiling                   24: Rel Vorticity                 
     0: Return to previous menu         -1: Exit program                  

   Enter the variable:

This menu only lists a small subset of what WXP can calculate.  Again, you can list the resource values with the "?" but this will only list those values enabled in the menu.  If you want all the available values, you can use the "list" command.  You can also create your own variables and modify existing ones.  Exactly how to do this will be left to a later tutorial.  A simple example of this is changing the units of a variable.  For example, temperature on surface plots is plotted in Fahrenheit.  To change it to Celsius, just put the desired units in brackets "[ ]":

   Enter the variable: temp[C]

Finally, any WXP resource can be set from any WXP prompt.  To view a list of set resources (those with values other than the program defaults), use the "set" command:

   Enter the variable: set
   Set resources
   default: /storm/wxp/etc
   file_path: /storm/wxp/etc
   data_path: /rainbow/data/ddplus
   con_path: /rainbow/data/convert
   grid_path: /storm/wxp/grid
   raw_path: /storm/wxp/raw
   ingestor: split
   font_list: modern.fnt,gothic.fnt
   name_conv: hmdy
   current: la

You can then change any of these or set a new one by specifying the resource and its value:

   Enter the variable: set color_map=lblue

The resource is then set and the variable menu prompt returns.


Here are the methods for setting resources in WXP:

  • Resource File
    *data_path: /noaaport/nwstg/data
    grbcalc.data_path: /noaaport/nwstg/model
  • Environment Variables
    setenv wxpplot_domain at
    setenv wxpuacalplt.color_data blue
  • Command Line
    sfcwx -cu=la -pd=mw -va=all
    sfcwx 01062022
    sfcwx -help
  • Program prompts
    Enter the region: at
    Enter the region: 40,-105,1.5
    Enter the variable: temp[C]
    Enter the variable: set color_map=lblue

This should give you an idea on where resources can be modified and how to do it.  There will be more information on various resources in later tutorials.

For further information about WXP, email technical-support@weather.unisys.com
Last updated by Dan Vietor on June 20, 2001