WXP
User's Guide
system_over <<
system_resrcfile
>> system_parse

Resource File

The resource file is used to modify program default values. Thus this is often referred to as a defaults file.  Each line in the resource file represents a different resource value being set. All WXP programs share a single set of resource names.  The resource itself is not specific to a particular program.  There is the concept of a named resource that can be program or invocation specific.  Unnamed resources are referred to as global resources.

In general, there is a single setup for all WXP programs on a single set of networked computers. As a result, system wide, default resource values are set up in a system resource file.  The user may wish to create their own resource file that can augment or override the system resource file.

Resource File Location

The default resource file is .wxpdef which is stored in your current working directory or the location specified by the wxpdefault environment variable.  If the .wxpdef file does not exist, then file Wxp.res is used.  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).  

The user may also want to use their own set of resources which would be specified:

   setenv wxpdefault MyWXP.resources

or you can specify a complete path to the file:

   setenv wxpdefault /home/wxp/etc/CaseWXP.res

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 in the last resource file takes precedence. The resource file location can be changed on the command line of each program.

   setenv wxpdefault /home/wxp/etc

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 in the last resource file takes precedence.

NOTE: It is recommended that the wxpdefault environment variable be set in the login shell's startup script (e.g. .cshrc for C-shell).

The value of resource file location can be changed at any time or can be specified on the command line of each program:

sfcwx -default=/home/user/synoptic.res ...

Resource File Syntax

The resource file contains a list of resource defaults used by all WXP programs. Each line in the resource file contains a resource and its default value:

resource_name: default_value

Resources can be tailored by program, by name or set globally:

Complex Resources

Named resources can have complex names in order to organize defaults.  A wildcard character "*" can be used to use complex resource defaults in more than one case.  For example the following resource structure is desired:

grbcalc
   data_path: /home/wxp/model
   plot_domain: ngm

   ngm
      model: ngm
      prec
         color_table: rainbow.clr
         color_fill: prec.cfl
         color_cmap: white
         variable: prec
         plot_type: cf
         level: snd

A full resource name would be grbcalc.ngm.prec.level but we want to carry over all the resources from grbcalc and ngm. These can be specified with a combination of absolute and wildcard resource specifications.

grbcalc*data_path: /home/wxp/model
grbcalc*plot_domain: ngm
*ngm*model: ngm
*ngm.prec.color_table: rainbow.clr
*ngm.prec.color_fill: prec.cfl
*ngm.prec.color_cmap: white
*ngm.prec.variable: prec
*ngm.prec.plot_type: cf
*ngm.prec.level: snd

The named resource will be specified as:

grbcalc -name=grbcalc.ngm.prec

and this will use all the resources listed above. This way resource files can be simplified and changing one resource can propagated quickly to the other complex resources.

There is a shortcut so the program name does not need to be specified every time:

grbcalc -name=+ngm.prec

and the program name is automatically prepended.

Conditional Resources

In some cases, resources may need to be changed in rare occasions.  For example, a data feed is down and an alternate feed needs to be used.  An example of this is:

IF NOAAPORT
grbcalc*data_path: /data/model
ELIF WXP
grbcalc*data_path: /home/wxp/model
ELSE
grbcalc*data_path: /home/wxp/data
END LDM

In this case, the first line is used if NOAAPORT is defined, otherwise the second if WXP is defined or the third otherwise. You can define NAAPORT in two places. You can add a line to the resource file:

DEF NOAAPORT

This carries over to all subsequent resource files. You can undefine a tag with:

UNDEF NOAAPORT

The more common method is to add the definition to the wxpdefault environment variable:

setenv wxpdefault +noaaport:~devo/.wxpdef
or 
grbcalc -default +noaaport:~devo/.wxpdef

For further information about WXP, email devo@ks.unisys.com
Last updated by Dan Vietor on July 21, 1998

system_over <<
system_resrcfile
>> system_parse