Enter a ZIP code to get a forecast:
Setup Location

WRN Logo

Resource: current

Resource current
Command Line -cu=name
Environment Variable wxpcurrent
Default Value None

The current resource is used to specify a current data file based on date and time.  The files being used by the program must have a naming convention that has a date element.  

The value of the current resource is actually an offset from the current time.  The simplest ways to specify the offset are as follows:

  • -cu - uses the current data file no matter what.  If the current data file does not exist, the program will exit.
  • -cu=1 - uses the data file that is one hour old.
  • -cu=3d04 - uses the data file that is 3 days, 4 hours old.
  • -cu=0:15 - uses the data file that is 15 minutes old.

Latest Files

If the current file is not available, you may want to just get the most current file, the latest file.  If you specify -cu=la, the program will search back through the most recent 500 times, create a filename and check to see if it exists.  If the file name convention specifies a file every 12 hours as with upper air data, it will first check the current time, if the file does not exist, it check for the file that would be 12 hours old, and so on.  If the file name convention specifies a file every 5 minutes as with NIDS and NOWRad data, it will search back in 5 minute increments.

Now the absolute offset and the latest can be combined.  Say, you want the first available data file that is at least 5 hours old, you would specify -cu=5-la.  Say you want the file that is 5 hours previous to the latest, you would specify -cu=la-5.  You can have forward searches as in -cu=3d+la or -cu=la+2.  This would find the latest and search forward 2 hours.  This will be discussed more in the next section.

Sequence numbers and wxpcurtime environment variable

WXP offers the concept of a sequence number which is an absolute time specification that is irrelevant of the file naming convention.  If you wanted the data file from 12Z 22 Dec 1996, you would specify:

   -cu=#199612221200

The format of the seqence number is 4 digit year, 2 digit month, 2 digit day, 2 digit hour and 2 digit hour.  Any value omitted is assumed to be 0 so you could have left off the last two zeros.

Now we can offset from this time:

   -cu=#1996122112-la

which will start at this time and search backwards for the first available file.

If you want this sequence number to be the default starting point and don't want to continue to specify it in the current resource, you can set the wxpcurtime environment variable.  Since this can only be a sequence number, the number sign "#" can be omitted:

   setenv wxpcurtime 1996122112

This is a handy feature when dealing with case studies and being able to use the current resource with old data.  If you have a case study on the time above, you may want to set this environment variable to be the most important time of the case like when the tornadoes are occurring.  Then the students can just use -cu to reference that time without worrying about the file naming convention.  Now, the concept of forward offsets and forward latest searching comes in handy.  Now you can look forward and backwards from the reference time with ease by using the current resource.

Complete Syntax

Here is the complete syntax of the current resource.  Any of the parts can be omitted.

   [#yyyymmddhhnn][+-##d##:##][+-la][+-##d##:##]

#yyyymmddhhnn - sequence number
##d##:## - number of days, hours, minutes (all are optional)
la - find latest in each direction


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