There are four conceptual categories of data:
The main body of the shell script below the user options is a loop over the four categories. For each category, the shell script checks the user's setting of the source of analyses, i.e., for categories 3D, SST, SNOW, and SOIL, the script checks shell variables SRC3D, SRCSST, SRCSNOW, and SRCSOIL, respectively. The script compares these shell variables against known options (e.g., GRIB, ON84, NAVYSST, NCEP), and when it finds a match, it goes into the appropriate subdirectory, links the appropriate files, runs the appropriate program, and moves the output files back up to the "pregrid" directory.
Some pseudo-code may be useful:
foreach Category ( 3D SST SNOW SOIL )if ( user option for $Category matches ON84 ) thenendProcess ON84 Data for the given Category.else if ( user option for $Category matches NCEP ) then
If ( $Category == 3D ), output files are called "ON84:YYYY-MM-DD_HH"
If ( $Category == SST ), output files are called "ON84_SST:YYYY-MM-DD_HH"
If ( $Category == SNOW ), output files are called "ON84_SNOW:YYYY-MM-DD_HH"Process NCEP Data for the given Categoryelse if ( user option for $Category matches NAVYSST ) then
If ( $Category == 3D ), output files are called "NCEP:YYYY-MM-DD_HH"
If ( $Category == SST ), output files are called "NCEP_SST:YYYY-MM-DD_HH"
If ( $Category == SNOW ), output files are called "NCEP_SNOW:YYYY-MM-DD_HH"Process NAVY SST Data for the given Categoryelse if ( user option for $Category matches GRIB ) then
Output files are called "NAVY_SST:YYYY-MM-DD_HH"
Process GRIB Data for the given Categoryendif
If ( $Category == 3D ), output files are called "FILE:YYYY-MM-DD_HH"
If ( $Category == SST ), output files are called "SST_FILE:YYYY-MM-DD_HH"
If ( $Category == SNOW ), output files are called "SNOW_FILE:YYYY-MM-DD_HH"
If ( $Category == SOIL ), output files are called "SOIL_FILE:YYYY-MM-DD_HH"
This setup works well if each category of data comes in its own separate file, or in a separate data set. The astute reader, however, will notice that this setup may result in much repetition. For example, if all of your 3D, SST, SNOW, and SOIL fields are in a single GRIB file, that GRIB file must be opened and read four separate times, once for each category of data. Most of the fields are ignored each time, with only the data matching the given category actually extracted. Things could be much more efficient if you could read through the GRIB file once, and extract all four categories of data as you go.
The shell script is set up to allow users to do this easily, at least for the GRIB case. The script variable VT3D (as well as the script variables VTSST, VTSNOW, and VTSOIL ) is interpreted as a list of values, each element of the list is a Vtable file name. Before the pregrid_grib.exe program is run, all elements of the list are cat'ed (Unix "cat" command) into one Vtable file, to be read by the program. Every field in the GRIB file which matches a Vtable entry is extracted.
So, you may list in VT3D the separate Vtables for the 3D data, SST data, SNOW data, and SOIL data. Turn off all the SRCSST, SRCSNOW, SRCSOIL, InSST, InSnow, InSoil script variables. Essentially, you're saying that all the data, 3D, SST, SNOW, and SOIL, may be considered part of the "3D" dataset, and read in one execution of the pregrid_grib.exe program.
Instead of
you may setset SRC3D = GRIBwhich runs the program pregrid_grib.exe four times and returns fields separated into files called "FILE:YYYY-MM-DD_HH", "SST_FILE:YYYY-MM-DD_HH", "SNOW_FILE:YYYY-MM-DD_HH", and "SOIL_FILE:YYYY-MM-DD_HH",
set InFiles = Your_Grib_File
set SRCSST = GRIB
set InSST = Your_Grib_File
set SRCSNOW = GRIB
set InSnow = Your_Grib_File
set SRCSOIL = GRIB
set InSoil = Your_Grib_File
set VT3D = Appropriate_3D_Vtable
set VTSST = Appropriate_SST_Vtable
set VTSNOW = Appropriate_SNOW_Vtable
set VTSOIL = Appropriate_SOIL_Vtable
or you could even setset SRC3D = GRIBwhich returns all the fields in files called "FILE:YYYY-MM-DD_HH". It is important to note that even though you do not get files called "SST_FILE:...", "SNOW_FILE:...", or "SOIL_FILE"...", the SST, snow, and soil fields will be in the "FILE:YYYY-MM-DD_HH" files.
set InFiles = Your_Grib_File
set VT3D = ( \
Appropriate_3D_Vtable \
Appropriate_SST_Vtable \
Appropriate_SNOW_Vtable \
Appropriate_SOIL_Vtable )
The same sort of argument works if, for example, you want to get atmospheric fields from the ON84 dataset, and SST and Snow from a GRIB Dataset (and you choose not to get soil fields). In this case, you could set:set SRCSST = GRIBwhich returns all the fields in files called "SST_FILE:YYYY-MM-DD_HH". It is important to note that even though the files are labelled SST, they contain all the fields, not just SST.
set InSST = Your_Grib_File
set VTSST = ( \
Appropriate_3D_Vtable; \
Appropriate_SST_Vtable \
Appropriate_SNOW_Vtable \
Appropriate_SOIL_Vtable )
set SRC3D = ON84which returns the atmospheric fields in files called "ON84:YYYY-MM-DD_HH", and the SST and Snow fields in files called "SST_FILE:YYYY-MM-DD_HH". Again, note that even though the file is labelled "SST_FILE" and there is no "SNOW_FILE", both SST and SNOW fields are in the "SST_FILE". Note also that you do not need to set the VT3D variable, because your SRC3D is ON84 and not GRIB.
set InFiles = Your_ON84_File
set SRCSST = GRIB
set InSST = Your_Grib_File
set VTSST = ( Appropriate_SST_Vtable Appropriate_SNOW_Vtable )
Last modified: Tue Jun 6 13:53:09 MDT 2000