GRAPH Tutorial

(03/20/2002)

Program GRAPH is the plotting utility program in the suite of the MM5 modeling system that you can use to plot output from all MM5 programs (TERRAIN_DOMAINx, REGRID_DOMAINx, RAWINS_DOMAINx, LITTLE_R_DOMAINx, MMINPUT_DOMAINx, LOWBDY_DOMAINx, MMOUT_DOMAINx, and MMOUTP_DOMAINx) - see figure. It is based on NCAR Graphics and requires the NCAR Graphics library to run. As a good piece of news for MM5 users, NCAR provides the NCAR Graphics library used by MM5 programs for free.

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

Where to Start?

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

gunzip GRAPH.TAR.gz
tar -xvf GRAPH.TAR

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

cd GRAPH

and you should see the following files and subdirectories listed:

ls -l

-rwxr-xr-x   1 mesouser system      1679 Jan 26 10:06 CHANGES
drwxr-xr-x   2 mesouser system      8192 Dec  5 18:18 Diff
-rwxr-xr-x   1 mesouser system      3918 Mar 12 17:12 Makefile
-rwxr-xr-x   1 mesouser system      5963 Feb 11 10:09 README
-rwxr-xr-x   1 mesouser system      1212 Jul 31  1999 README.namelist
drwxr-xr-x   2 mesouser system      8192 Mar 13 14:57 Templates
-rwxr-xr-x   1 mesouser system      1288 Jul 31  1999 g_color.tbl
-rwxr-xr-x   1 mesouser system       392 Jul 31  1999 g_defaults.nml
-rwxr-xr-x   1 mesouser system       796 Jul 31  1999 g_map.tbl
-rwxr-xr-x   1 mesouser system      6721 Jul 31  1999 g_plots.tbl
-rwxr-xr-x   1 mesouser system      4337 Mar 13 14:57 graph.csh
drwxr-xr-x   2 mesouser system     16384 Mar 28 12:02 src

where
g_color.tbl: a list of color codes used by NCAR Graphics
g_defaults.nml: namelist for Graph. Read README.namelist for detail
g_map.tbl: setups for plotting map background
g_plots.tbl: file to edit to select time, level, and field to plot
graph.csh: c-shell script to run Graph job

For a complete explanation of each table and namelist file, click on the respective links above. For basic plotting, only the g_plots.tbl requires editing. Also read the README file in the directory.

Now you are ready to work with Graph.

How to Run GRAPH?

1. Type the following to compile Graph:

make >& make.out &

If it is successful, graph.exe will be created and linked to the top directory as shown here:

lrwxrwxrwx   1 mesouser system            13 Mar 28 12:02 graph.exe -> src/graph.exe
-rw-r--r--   1 mesouser system     30307 Mar 28 12:02 make.out

2. Edit g_plots.tbl to select appropriate times, levels, and fields to plot. Click on the link to see the general rules for editing this file.

Different MM5 system output files require g_plots.tbl be editted slightly differently. For examples, check out the following:

g_plots.tbl for Terrain output
g_plots.tbl for pressure-level data (output from REGRID, RAWINS, LITTLE_R and INTERPB)
g_plots.tbl for plotting cross-sections and skew-T with pressure-level data
g_plots.tbl for input file to MM5
g_plots.tbl for MM5 model output files
g_plots.tbl for plotting sigma-level data on pressure and isentropic levels
g_plots.tbl for plotting cross-section and skew-T with sigma-level data

For complete reference to all plot variables, please see section 12.8 - 12.10 in Chapter 12 of the Tutorial Notes.

3. Type the following command to run the Graph program:

graph.csh n m X_DOMAINx

where "n" in the command is the number of plot files to split (rarely used, but may be used to split plots into several pieces based on time periods), "m" is the number of input files to be expected, and X_DOMAINx is MM5 modeling system output file (e.g. MMOUT_DOMAIN1). You can have more than one input file for Graph job, but they must come from the same domain. So for a typical Graph job where you don't want to split plot file, and you only have one input file, the command is

graph.csh 1 1 X_DOMAINx

If you have two files as input to Graph (for example, one from a MM5 run, and the other from the restart), you may type

graph.csh 1 2 mm5-file1 mm5-file2

If you name the input files as mm5-fileA, mm5-fileB, mm5-fileC etc., you can simply type the command using the 'root' name, and the shell script knows to look for all relevant files:

graph.csh 1 3 mm5-file

The output file from Graph is called 'gmeta', which is an NCAR Graphics formated plot file. To view gmeta generated by Graph, one must use the NCAR Graphics utility 'idt' (more information can be found on the man page: man idt), i.e.,

idt gmeta &

You may also find another gmeta file in the directory: gmeta.split1. This is the same as gmeta file. If you used n>1, you'd find gmeta.split1, gmeta.split2, ..., gmeta.splitn in the directory. Each of these splitted file would contain a subset of the entire plot file.

You may convert the gmeta file to a number of other graphic formats. For example, to convert to black-white postscript file, you can use the command

ctrans -d ps.mono gmeta > gmeta.ps

'-d ps.color' will allow you to translate color plots. For more information, check man page on 'ictrans'.
 

Sample plots from MM5 model output for SOC case:

Mean-sea-level pressure plots at 6 hourly interval (5 plots, at 00, 06,12, 18, and 24 h).
Six-hourly precipitation field (4 plots, at 06, 12, 18 and 24 h).
Cross-section plots at hour 24 cutting through the warm front.
Skew-T plots at hour 24 north of the warm front.


Miscellanies:

1. If your data size is greater than 200x200x40 in i, j and k directions, you should modify two include files in the src/ directory to increase the dimesions: data.incl and scratch.incl.

2. If the input data to GRAPH is on sigma, then vertical interpolation is possible. For example, this g_plots.tbl shows how to plot sigma-level data on pressure levels for variable temperature and geopotential height, and this g_plotst.tbl shows how to plot sigma-level data on isentropic levels for PV and pressure.

3. For a  list of available fields that can be plotted with GRAPH click here.

4. If you would like to do color plots, an alternative program called RIP, may be easier to use. RIP is also based on NCAR Graphics.

5. If you don't have NCAR Graphics, you can choose to look at your data using other plotting packages. But you may need to develop an interface program to convert MM5 data to the data readable by the other graphic package. The only alternatives that we support at the moment are Vis5D, and GrADS. We provide conversion programs to convert MM5 data to Vis5D data and to GrADS data. Detailed desription of the MM5 V3 data format can be found in Chapter 13 of the Tutorial Notes.

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


Trouble Shooting:

On Sun and HP, you may need to modify graph.csh.

1. You may need to remove the first line

#!/bin/csh

2. You may need to modify two if statements. Change

if ( ( -e ${ForUnit}20 ) || ( -l ${ForUnit}20 ) ) rm ${ForUnit}2*

to

if ( -e ${ForUnit}20 ) rm ${ForUnit}2*

and from

if ( ( -e ${ForUnit}18 ) || ( -l ${ForUnit}18 ) ) rm ${ForUnit}18

to

if ( -e ${ForUnit}18 ) rm ${ForUnit}18
 


If you have questions, ask mesouser.


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