REGRID Tutorial

(updated 2/13/2001)

Program REGRID is the second program in the suite of MM5 system programs. This program creates meteorological fields on the mesoscale grid you designed in program TERRAIN. This is also the first place you will select the time period of the case. You should not be here if you have not successfully run TERRAIN program.

REGRID has two seqential programs: pregrid and regridder. Program pregrid pre-processes gridded, pressure-level meteorological fields from another source (such as the NCAR archive, and NCEP's ftp server) and puts the data in an intermediate format. Program regridder takes the intermediate-format data and output file from TERRAIN, and creates what we call a "first-guess" for subsequent programs. The output file from REGRID will have 3-dimensional meteorological fields of wind, temperature, relative humidity, geopotential height, and 2-dimensional fields like sea-level pressure and sea-surface temperature.

To learn more about how the REGRID program works, please read Chapter 5 of the Tutorial Notes.

NOTE: Because MM5 is a regional model, it requires initial condition as well as lateral boundary condition to run. The requirement of lateral boundary conditions means that you will need to obtain data to cover the entire model integration period during pre-processing. For example, if you want to make a 24-h model run, your first-guess is available at 12 hourly intervals, you will need to obtain data at 0, 12 and 24-h times in order to make the MM5 run. Even you only want to integrate the model for less than 24 hours, it is a good practice to obtain data for at least one whole day. This is because the surface air temperature will be averaged (in INTERPF) to calculate what is called the 'substrate temperature' or 'deep soil' temperature for MM5 to use as a lower boundary condition. Averaging daily temperature would give you a better estimate than using temperatures for day time or night time alone.

Where to Start?

First, go to directory MM5V3 and download the REGRID program tar file from NCAR's ftp site. Once you have it on your machine, type the following to unzip and untar it:

gunzip REGRID.TAR.gz
tar -xvf REGRID.TAR

After this, you should see a program directory REGRID/ created in your working directory. cd to this directory:

cd REGRID

and you should see the following files and subdirectories listed:

ls -l

-rwxr-xr-x   1 mesouser users       9613 Jan 17 12:37 CHANGES
drwxr-xr-x   2 mesouser users       8192 Jan 17 13:59 Diff
-rwxr-xr-x   1 mesouser users      15142 Nov 29 15:01 Makefile
-rw-r--r--   1 mesouser users       5028 Dec  4 12:28 README
-rwxr-xr-x   1 mesouser users        462 Jul 31  1999 configure.rules
-rwxr-xr-x   1 mesouser users      12723 Dec  4 12:30 cray-regrid.deck
-rw-r--r--   1 mesouser users      25066 Dec  4 12:30 ibm-regrid.deck
-rw-r--r--   1 mesouser users        390 Jan 17 14:17 macros_pregrid
-rw-r--r--   1 mesouser users        336 Jan 17 14:17 macros_regridder
drwxr-xr-x  11 mesouser users       8192 Jan 17 14:19 pregrid
drwxr-xr-x   4 mesouser users       8192 Jan 17 14:23 regridder
 

Read the README file in the directory.

Now download the test data: NCEP_ON84.9303 from the ftp site:

-rw-r--r--   1 mesouser system   8735040 Mar 23  NCEP_ON84.9303

This data is from NCEP's global data assimilation system (GDAS) prior to April 1997. The data format is called ON84. This dataset is now residing in directory REGRID.

Now you are ready to work with REGRID.

How to Run REGRID?

1. Compile REGRID:

REGRID is a Fortran 90 program. Its memory allocation is done at the run time stage. So you only need to compile it once unless you modify the code. There is no parameter statement to work with. To compile, type:

make >& make.out &

This compiles the code on a your machine, and writes output from "make" to file make.out. If it is successful, you should have created a few executables in several subdirectories under REGRID:

./pregrid/on84/pregrid_on84.exe
./pregrid/navysst/pregrid_navy.exe
./pregrid/ncep.grib/pregrid_ncep.exe
./pregrid/grib.misc/pregrid_grib.exe
./regridder/regridder
 

2. Running sub-program pregrid:

cd to pregrid direcotry:

cd pregrid

and you should see this:

ls -l
drwxr-xr-x   3 mesouser system      8192 Apr  6 11:31 Doc
-rwxr-xr-x   1 mesouser system       842 Jul 31  1999 Makefile
drwxr-xr-x   2 mesouser system      8192 Apr  6 11:31 era
drwxr-xr-x   2 mesouser system      8192 Apr  6 11:31 grib.misc
drwxr-xr-x   2 mesouser system      8192 Apr  6 11:31 navysst
drwxr-xr-x   2 mesouser system      8192 Apr  6 11:31 ncep.grib
drwxr-xr-x   2 mesouser system      8192 Apr  6 11:31 nnrp
drwxr-xr-x   2 mesouser system      8192 Apr  6 11:31 on84
-rwxr-xr-x   1 mesouser system      6636 Dec  7 09:58 pregrid.csh
drwxr-xr-x   2 mesouser system      8192 Apr  6 11:31 toga
drwxr-xr-x   2 mesouser system      8192 Apr  6 11:31 util

Edit pregrid.csh. This is a cshell script that is put together to handle several types of input data to pregrid. Again, the default script has everything selected to do the SOC case already. Note that the input data is the NCEP ON84. Do check the parameters defined in the deck against what is described in the Notes (Chapter 15). Also click on the example pregrid.csh to see highlighted parameters that need to be considered and changed if you start to configure your own case, and use data other than in the default script. For example, if your input data is GRIB format, don't forget to select the right Vtables.

Type the following to run pregrid:

pregrid.csh >& log &

If you are successful, you should find these additional files generated in the pregrid directory:

-rw-r--r--   1 mesouser system   2678508 Mar 17 17:57 ON84:1993-03-13_00
-rw-r--r--   1 mesouser system   2678508 Mar 17 17:57 ON84:1993-03-13_12
-rw-r--r--   1 mesouser system   2678508 Mar 17 17:57 ON84:1993-03-14_00
-rw-r--r--   1 mesouser system      42516 Mar 17 17:57 ON84_SNOW:1993-03-13_00
-rw-r--r--   1 mesouser system      42516 Mar 17 17:57 ON84_SNOW:1993-03-13_12
-rw-r--r--   1 mesouser system      42516 Mar 17 17:57 ON84_SNOW:1993-03-14_00
-rw-r--r--   1 mesouser system      42516 Mar 17 17:57 ON84_SST:1993-03-13_00
-rw-r--r--   1 mesouser system      42516 Mar 17 17:57 ON84_SST:1993-03-13_12
-rw-r--r--   1 mesouser system      42516 Mar 17 17:57 ON84_SST:1993-03-14_00
-rw-r--r--   1 mesouser system      10974 Mar 17 17:57 log

where log is a log file of all print statements generated by pregrid program, and files beginning with a prefix (such as ON84, SNOW and SST) and a time stamp are binary output from pregrid in the intermediate format. If you don't see these files, it would mean your pregrid job has failed. In this case, check your script to see if you have made any mistakes (such as where the input data file, NCEP_ON84.9303, is located), or look in log file to find any clues.

Near the end of the log file, you should see the following line if the job is finished correctly:

Normal termination of program PREGRID_ON84

If everything checks out ok, then your attempt to run pregrid should be a successful one. You can now move to the next stage of the REGRID program: regridder.

To read more about pregrid, check out the pregrid/Doc directory, or click here. This will be useful to you when your own input data changes from the example shown here. An example of how to set up pregrid.csh file to process a GRIB dataset is illustrated here.

3. Running sub-program regridder:

cd to regridder directory from pregrid directory:

cd ../regridder

Edit namelist.input for the regridder program. Again it is already editted to run the SOC case. But do check if everything is set up correctly. Especially you should make sure that the path for the TERRAIN file is correctly set. Also the example namelist file has the important namelist variables highlighted. These will be the ones you must change if you run your own case. For more details on the namelist variables, refer to Chapter 5 of the Tutorial Notes. Note, the namelist variable 'root' refers to the prefixes in the file names before ':' as generated by pregrid. For example, if a pregrid output file name is NCEP_SST:2001-05-16_00, then the root name is NCEP_SST.

Once the namelist file is editted, type the following to run regridder:

regridder >& log &

If the job runs successfully, you should see the following file generated:

-rw-r--r--   1 mesouser system   2177888 Mar 17 18:26 REGRID_DOMAIN1

This is the binary output file that can be used either in RAWINS, LITTLE_R or INTERPF. This file contains meteorological fields, winds, temperature, relative humidity and geopotential height, on mandatory pressure levels,1000, 850, 700, 500, 400, 300, 250, 200, 150, 100 mb [up to ptop], and additional levels you specify in the namelist.input file, and surface. If you choose certain datasets (such as Eta AWIP, NCEP/NCAR Reanalysis), and use Vtable for SOIL variables in pregrid, you also get a few soil temperature and moisture variables in the regridder output.

If you are going to run the RAWINS program next, pay attention to the print statement near the end of the log file: it tells you how to set the parameter statement in RAWINS (which is a Fortran 77 program and requires parameter statements):

*******************************************************************
                  Attention RAWINS users!
Here is a handy PARAMETER statement you can use for RAWINS.
Increase the LMX value by the number of new pressure levels that you want RAWINS to add.
      PARAMETER ( IMX =   45, JMX =   51, LMX =   21)
*******************************************************************

Note that if you used the IEXP option in the TERRAIN program for this case, the expanded domain dimensions for domain 1 are IX=45, and JX=51.

Unlike program TERRAIN, REGRID doesn't generate any plot files. To check whether your data is OK, you can run program GRAPH if you have NCAR Graphics on your machine.


Miscellanies:

1. Normally there is no need to run REGRID for more than the coarse domain. Depending on the application, the nest terrain files may be used in NESTDOWN to create nest input files for MM5 (for example, if one wants to use OSU land-surface model in MM5), or you can use nest TERRAIN files in MM5 directly. Running REGRID and RAWINS for coarse domain only will ensure data consistency in coarse/nest interface region and/or overlapping grid areas.

2. This example only shows you how to run the REGRID program, hence it already has the data prepared for you to run the SOC case. But before you start with your own case, you need to worry about where to obtain gridded data. Click here for more information on this topic.

3. If you would like to use NAVY SST, get it from NCAR's MSS under /MESOUSER/DATASETS/NAVYSST. Click here to see the complete listing of the available files. Use 'msread -f BI' to read the file.

4. If you plan on importing different gridded data into MM5, we recommend that you skip pregrid, and put the data directly in the intermediate format that regridder will accept.

5. For a brief  introduction to the REGRID program, you can also view the bi-annual tutorial slides.


Trouble Shooting:

1. On some Sun machines, it may have trouble reading the namelist. In that case, break the namelist variable 'root' into multiple lines like this:

  root(1)                = '../pregrid/ON84'
  root(2)                = '../pregrid/ON84_SST'
  root(3)                = '../pregrid/ON84_SNOW'

You may also need to remove the unused namelist entry, such as 'constant_full_name'.


If you have run REGRID successfully, move to the next program: RAWINS or LITTLE_R.

If you have questions, ask mesouser.


TUTORIAL_HOME
TERRAIN
REGRID
RAWINS/LITTLE_R
INTERPF
MM5
NESTDOWN
INTERPB
GRAPH
RIP
GrADS