How to use pregrid

The pregrid programs take several different kinds of input:
  1. The namelist, defining times you want to process.
  2. The archived analysis files.
  3. The Vtable file, which describes which fields to extract from the archive files, and what variable names are assigned.  Vtables are explained in more detail here.
The pregrid program scans through each of the input analysis files, checking on the dates.  For any dates which fall between your start time and end time (inclusive), pregrid scans through the archived fields and pulls out those which have been specified in the Vtable.  From these fields, pregrid builds (or adds to) preliminary output files, and the moves on to the next input file.  When all input files have been processed, and all pertinent data between the start time and end time have been written to the preliminary output files, pregrid rereads the output files, and builds in certain fields which may be missing.  The pregrid program then scans through all the files, searching for dates which are missing.  If it finds a missing date, it fills it in by temporal interpolation.  Then the final output files are written.
 

pregrid.csh c-shell script:

In the following discussion, examples of what may be set in the pregrid.csh script are in the following style:
sample code
The pregrid shell "pregrid.csh", is provided to run pregrid interactively on a workstation.  It is found in the directory REGRID/pregrid.  This shell is written in c-shell script language.  To use this shell effectively, some familiarity with c-shell script language is recommended.

To run the "pregrid.csh" script interactively:

  1. Get the analysis archives and put them in some directory on your local machine.
  2. Set the script variables.
  3. Fill out the namelist.
  4. Make sure you've got the right Vtables, especially if you're getting analyses other than the standard ones.
  5. Make sure "pregrid.csh" is executable ("chmod u+x pregrid.csh").
  6. Run pregrid.csh, by entering "pregrid.csh"
For notes on slightly more advanced use of the pregrid.csh shell script, go here. But first, read the rest of this page and be sure you understand the basic use of the pregrid.csh shell script and Vtables.

Script variables

DataDir:  The local directory where you've placed the original analysis archive files.  The DataDir script variable is simply a convenience, referenced only in the InFiles, InSST, InSnow, and InSoil script variables below, and only if you so desire to use it in setting InFiles, InSST, InSnow, or InSoil.
Example:  Your username is "smith", and you've got a directory "/users/smith/Data".  In this directory, you have put the analysis files you expect REGRID to read.  The "set DataDir" statement should look like:
set DataDir = /users/smith/Data
SRC3D:  The source of 3D analyses.  Select from one of the following:
ON84 : NCEP GDAS analyses, in ON84 format (before 1997 Mar).
NCEP : NCEP GDAS analyses, in GRIB format (beginning 1997 Mar).
GRIB : A catch-all for many other datasets in the GRIB format.

Example:  You've got meteorological analyses in GRIB format.  The "set SRC3D" statement should look like:

set SRC3D = GRIB
InFiles:  Full pathname to the files with 3D Analyses.
Example:  You've put GRIB files containing pressure-level analyses in the directory "/users/smith/Data".  The archives have been separated by surface and upper-air, and by date.  The files are called GRIBUPA.2400, GRIBUPA.2412,  GRIBSFC.2400, and GRIBSFC.2412.  The "set InFiles" statement might look like:
set InFiles = ( ${DataDir}/GRIBUPA.2400 ${DataDir/GRIBSFC.2400 \
                       ${DataDir}/GRIBUPA.2412 ${DataDir/GRIBSFC.2412 )
The order of the listing of the files should not matter.  Wild cards may be used, if you're careful. So the statement could look like:
set InFiles = ( ${DataDir}/GRIBUPA.24* ${DataDir}/GRIBSFC.24* )
or even something like:
set InFiles = ( ${DataDir}/GRIB*.24* )
If you've opted not to set the DataDir script variable above, you could still set Infiles like this:
set InFiles = ( /users/smith/Data/GRIB*.24* )


SRCSST:  Source of the SST Analyses.  Select from among the following:

ON84: NCEP GDAS analyses, in ON84 format.
NCEP: NCEP GDAS analyses, in GRIB format.
NAVY: Low-resolution Navy archives (roughly 2.5x2.5 degrees)
GRIB: A catch-all for many other datasets in the GRIB format.
$SCR3D: Same type as the 3D analyses

Example:  Your SST fields come from the ON84-formatted NCEP GDAS analyses.  In this case, your set SRCSST statement would look like:

set SRCSST = ON84
InSST:  Full pathname to the files with SST analyses.
Example:  Your SST fields come from the ON84-formatted NCEP GDAS analyses.  You have put those analysis files in the directory /users/smith/Data, in a file called ON84.DATA.  In this case, the "set InSST" statement might look like:
set InSST = ( ${DataDir}/ON84.DATA )
SRCSNOW: Source of snow-cover analyses.  The snow-cover field is optional in mm5, so you may choose not to retrieve snow-cover data.

InSnow: Full pathname to the files with Snow-cover analyses.

SRCSOIL:  Source of soil (i.e. ground) analyses (e.g., soil moisture, ground temperature, etc.)

InSoil: Full pathname to the files with soil-data analyses.

Next, there are a few script variables you need to set if you have set any of the above to GRIB.  These script variables denote the tables which  the GRIB pregridder is going to need in order to know which variables to extract from the GRIB files.  See Vtables for details on what exactly is in the Vtable files.

VT3D:   The Vtables for the files specified in InFiles.
VTSST:  The Vtables for the files specified in InSST.
VTSNOW: The Vtables for the files specified in InSnow.
VTSOIL: The Vtables for the files specified in InSoil.

Namelist:

There is a small namelist built by the "pregrid.csh" script.  This namelist file is named "pregrid.namelist", and defines the dates you want to process:

The starting date of the time period you want to process is set by  START_YEAR, START_MONTH, START_DAY, and START_HOUR.

The starting date of the time period you want to process is set by  END_YEAR, END_MONTH, END_DAY, and END_HOUR.

The time interval for which you want to process files is set by INTERVAL.
 

 START_YEAR  = 1987   # Year (YYYY)
 START_MONTH = 08     # Month ( 01 - 12 )
 START_DAY   = 02     # Day ( 01 - 31 )
 START_HOUR  = 12     # Hour ( 00 - 23 )

 END_YEAR  = 1987     # Year (Four digits)
 END_MONTH = 08       # Month ( 01 - 12 )
 END_DAY   = 04       # Day ( 01 - 31 )
 END_HOUR  = 00       # Hour ( 00 - 23 )

 INTERVAL =  43200 # Time interval (seconds) to process.
                   # This is most sanely the same as the time interval for
                   # which the analyses were archived, but you can really
                   # set this to just about anything, and pregrid will
                   # interpolate in time and/or skip over time periods for
                   # your regridding pleasure.


In addition to the above namelist parameters, there are a few "hidden" namelist parameters.  They are "hidden" in that they are not included in the default "pregrid.csh" file, but have default values set for them in the program.  If you need to change the default values, you can add them to the namelist yourself:
 

DEBUG_PRINT:  Default value is .FALSE.  For additional printout, which may or may not be useful for diagnosing problems when pregrid fails, add the following line to the namelist:
DEBUG_PRINT = .TRUE.


ORDERED_BY_DATE:  Default value is .TRUE.  If your fields are not ordered in time in a GRIB-formatted dataset, add the following line to the namelist:

ORDERED_BY_DATE = .FALSE.


Documentation HOME

Last modified: Tue Jun 6 13:54:34 MDT 2000