Enter a ZIP code to get a forecast:
Setup Location

WRN Logo

Setting Resources

WXP has several methods for accessing and modifying resources.

Program Defaults

Each program initializes the resource to either a value or the value is prompted for while the program is running.  These are hardcoded into the source code and can be modified by the means listed below. 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 of possible choices and prompt for the value.  An example of this is the region and variable resources.  

Resource File

Often, the hardcoded defaults are not appropriate.  As a result, there needs to be a mechanism to reset program defaults or those values that rarely change.  To accomplish this, a resource file is available where those resources and the default values are saved. Since the names of resources are common to all WXP programs, there is a way of creating named resources that can be based on the name of the program or toggled from the command line.  Unnamed resources are called global resources that are used by all programs.

   *data_path: /home/wxp/data

If a resource needs to be specifically set for a program, you can specify a named resource.

   sacvt.out_file: cdf

Resource File Location

The default resource file is ".wxpdef" ("wxp.def" for Windows) which is stored in your current working directory or the location specified by the wxpdefault environment variable.  This is often used to set a system wide resource file.  This way, a common environment can be used for all users on the system.

   setenv wxpdefault /home/wxp/etc

It is recommended that this location be set in the user's shell startup script (e.g. .cshrc for C-shell).  

To group system and local resource files, each file can be specified separated by a colon ':'.

   setenv wxpdefault /home/wxp/etc:~user/MyWXP.res

The resource files are processed in the order listed so resources listed and the last resource file takes precedence. The resource file location can be changed on the command line of each program.

Environment Variables

At times, program defaults need to be set for multiple program runs.  It is unnecessary to continual modify the resource file is these situations. Also, it is not recommended to set those command line arguments every time a program is run. Therefore, a set of environment variables is provided for each resource.  The name of the environment variable is just "wxp" + the resource name.  So the current resource has an associated environment variable "wxpcurrent". For example:

   setenv wxpcurrent la

will specify to use the latest (la) available file. Each program will use this value for the current resource until this environment variable is either reset or unset.

There are 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 used to set temporary defaults, which can be handy for use with case studies or specialized situations.

Command Line

Each resource can be specified on the command line.  Command line parameters are only valid for that program invocation and will not carry over to the next WXP program run.  If more permanent values are to be set, look at setting resource values via the resource file or environment variable.

The syntax for the command line is very similar to the to that for other methods.  Most of the resources are keyed resources.  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 -region=mw
   sfcwx -variable all

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 that is listed below.

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 -re=us -me=none -va=all -ti=US_PLOT -cu=la

In most programs, there is a positional (non-keyed) resource.  A positional parameter does not need to have the resource specified and ONLY its value is listed:

   sfcwx 96112103

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 96112103 -de=d -me=none -ti=US_PLOT

Program Menus and Prompts

For those resources that are not set either from the resource file, environment variables or through the command line, initial defaults are used.  In some cases, the default action is to prompt the user for the value for that resource.  Often these prompts are preceded by a list of options or menus.  By selecting the value from the menu, the value of that resource is set.

Common Resource 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

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