0% found this document useful (0 votes)
184 views

GrADS Tutorial

This document presents a brief tutorial on how to use the basic capabilities of the Grid Analysis and Display System (GrADS). The tutorial demonstrates how to open sample data files, set dimension environments to display data in different ways like contour plots, Hovmoller plots, and vertical cross sections. It also shows how to perform operations on data like unit conversions, time averaging, and computing derivatives. Graphics controls are also covered like setting contour levels, colors, and displaying vectors and streamlines.

Uploaded by

Ai Cinta
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
184 views

GrADS Tutorial

This document presents a brief tutorial on how to use the basic capabilities of the Grid Analysis and Display System (GrADS). The tutorial demonstrates how to open sample data files, set dimension environments to display data in different ways like contour plots, Hovmoller plots, and vertical cross sections. It also shows how to perform operations on data like unit conversions, time averaging, and computing derivatives. Graphics controls are also covered like setting contour levels, colors, and displaying vectors and streamlines.

Uploaded by

Ai Cinta
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

13/02/28

GrADS Tutorial

Tutorial (En Espaol)


What is it?
This document presents a brief tutorial for Brian Doty's Grid Analysis and Display System (GrADS). The following sample session will give you a feeling for how to use the basic capabilities of GrADS. This sample session takes about 30 minutes to run through. Here is a copy of

Before you start:download the sample data


You will need the following sample data files in order to go through this tutorial:
mdlcl oe.t mdlgb oe.r mdlgp oe.m

GrADS descriptor file (0.7 kb) GrADS (GRIB) data file (579 kb) GrADS gribmap index file (4 kb)

This data file is described by the data descriptor file m d l c l You may want to look at this file oe.t. before continuing. The data descriptor file describes the actual data file, which in the case contains 5 days of global grids that are 72 x 46 elements in size. Please download these 3 files to a local directory before proceeding.

Sample Session
To start up GrADS, enter:
gas rd

If the g a sexecutable is not in your current directory, or if it is not in your PATH rd somewhere, you may need to enter the full pathname, ie:
/s/oe/mt/rd/rd urhmssihgasgas

GrADS will prompt you with a landscape vs. portrait question; just press enter. At this point a graphics output window should open on your console. You may wish to move or resize this window. Keep in mind that you will be entering GrADS commands from the window where you first started GrADS -- this window will need to be made the 'active' window and you will not want to entirely cover that window with the graphics output window. In the text window (where you started grads from), you should now see a prompt: g - You a> will enter GrADS commands at this prompt and see the results displayed in the graphics output window. The first command you will enter is:
oe mdlcl pn oe.t

You may want to see what is in this file, so enter:


qeyfl ur ie

One of the available variable is called p , for surface pressure. We can display this variable s by entering:
dp s dis

short for d s l y You will note that by default, GrADS will display an X, Y plot at the ipa. first time and at the lowest level in the data set.
www.iges.org/grads/gadoc/tutorial.html 1/9

13/02/28

GrADS Tutorial

Now you will enter commands to alter the d m n i n e v r n e t The d s l ycommand ieso niomn. ipa (and implicitly, the access, operation, and output of the data) will do things with respect to the current dimension environment. You control the dimension environment with the s t e command:
cer la stln-0 e o 9 stlt4 e a 0 stlv50 e e 0 stt1 e dz

clears the display sets longitude to 90 degrees West sets latitude to 40 degrees North sets level to 500 mb sets time to first time step displays the variable 'z'

In the above sequence of commands, we have set all four GrADS dimensions to a single value. When we set a dimension to a single value, we say that dimension is "fixed". Since all the dimensions are fixed, when we display a variable we get a single value, in this case the value at the location 90W, 40N, 500mb, and the 1st time in the data set. If we now enter:
stln-8 0 e o 10 dz

X is now a varying dimension

We have set the X dimension, or longitude, to vary. We have done this by entering two values on the set command. We now have one varying dimension (the other dimensions are still fixed), and when we display a variable we get a line graph, in this case a graph of 500mb Heights at 40N.

www.iges.org/grads/gadoc/tutorial.html

2/9

13/02/28

GrADS Tutorial

Now enter:
cer la stlt09 e a 0 dz

We now have two varying dimensions, so by default we get a contour plot. If we have 3 varying dimensions:
c stt15 e dz

we get an animation sequence, in this case through time. Now enter:


cer la stln-0 e o 9 stlt-09 e a 9 0 stlv10 10 e e 00 0 stt1 e dt du

In this case we have set the Y (latitude) and Z (level) dimensions to vary, so we get a vertical cross section. We have also displayed two variables, which simply overlay each other. You may display as many items as you desire overlaid before you enter the c e r la command.

www.iges.org/grads/gadoc/tutorial.html

3/9

13/02/28

GrADS Tutorial

Another example, in this case with X and T varying (Hovmoller plot):


c stln-8 0 e o 10 stlt4 e a 0 stlv50 e e 0 stt15 e dz

Now that you know how to select the portion of the data set to view, we will move on to the topic of operations on the data. First, set the dimension environment to an Z, Y varying one:
cer la stln-8 0 e o 10 stlt09 e a 0 stlv50 e e 0 stt1 e
www.iges.org/grads/gadoc/tutorial.html 4/9

13/02/28

GrADS Tutorial

Now lets say that we want to see the temperature in Fahrenheit instead of Kelvin. We can do the conversion by entering:
dsly(-7.6*/+2 ipa t231)953

Any expression may be entered that involves the standard operators of +, -, *, and /, and which involves operands which may be constants, variables, or functions. An example involving functions:
cer la dsr(*+*) qtuuvv

to calculate the magnitude of the wind. A function is provided to do this calculation directly:
dmguv a(,)

Another built in function is the averaging function:


cer la daezt1t5 v(,=,=)

In this case we calculate the 5 day mean. We can also remove the mean from the current field:
dz-aezt1t5 v(,=,=)

We can also take means over longitude to remove the zonal mean:
cerdzaezx1x7) la -v(,=,=2 dz

We can also perform time differencing: clear d z(t=2)-z(t=1) This computes the change between the two fields over 1 day. We could have also done this calculation using an offset from the current time:
dzt1 -z (+)
www.iges.org/grads/gadoc/tutorial.html 5/9

13/02/28

GrADS Tutorial

The complete specification of a variable name is:


nm.iedm+-=vle .. aefl(i || au, .)

If we had two files open, perhaps one with model output, the other with analyses, we could take the difference between the two fields by entering:
dslyz2-z1 ipa . .

Another built in function calculates horizontal relative vorticity via finite differencing:
cer la dhuluv cr(,)

Yet another function takes a mass weighted vertical integral:


cer la dvn(sq25 itp,,7)

Here we have calculated precipitable water in mm. Now we will move on to the topic of controlling the graphics output. So far, we have allowed GrADS to chose a default contour interval. We can override this by:
cer la stcn 3 e it 0 dz

We can also control the contour color by:


cer la stcoo 3 e clr dz

We can select alternate ways of displaying the data:


cer la stgotsae e xu hdd dhuluv cr(,)

This is not very smooth; we can apply a cubic smoother by entering:


cer la stcmoho e sot n dhuluv cr(,)

www.iges.org/grads/gadoc/tutorial.html

6/9

13/02/28

GrADS Tutorial

We can overlay different graphics types:


stgotcnor e xu otu stcoo 0 e clr stcn 3 e it 0 dz

and we can annotate:


da tte50bHihsadVriiy rw il 0m egt n otct

We can view wind vectors:


cer la stgotvco e xu etr duv ;

Here we are displaying two expressions, the first for the U component of the vector; the
www.iges.org/grads/gadoc/tutorial.html 7/9

13/02/28

GrADS Tutorial

2nd the V component of the vector. We can also colorize the vectors by specifying a 3rd field:
duvq ;;

or maybe:
duvhuluv ;;cr(,)

You may display pseudo vectors by displaying any field you want:
cer la dmguv ;q100 a(,) *00

Here the U component is the wind speed; the V component is moisture. We can also view streamlines (and colorize them):
cer la stgotsra e xu tem duvhuluv ;;cr(,)

Or we can display actual grid point values:


cer la stgotgi e xu rd du

We may wish to alter the map background:


cer la stln-1 -0 e o 10 7 stlt3 4 e a 0 5 stmde nm e pst a stdgie02 e isz . stdgu 2 e inm du

To alter the projection:


stln-4 -0 e o 10 4 stlt1 8 e a 5 0
www.iges.org/grads/gadoc/tutorial.html 8/9

13/02/28

GrADS Tutorial

stmvl -2 -52 6 e pas 10 7 5 5 stmrjns e po p stgotcnor e xu otu stcn 3 e it 0 dz

In this case, we have told grads to access and operate on data from longitude 140W to 40W, and latitude 15N to 80N. But we have told it to display a polar stereographic plot that contains the region bounded by 120W to 75W and 25N to 65N. The extra plotting area is clipped by the map projection routine.

This concludes the sample session. At this point, you may wish to examine the data set further, or you may want to go through the GrADS documentation and try out the other options described there.

www.iges.org/grads/gadoc/tutorial.html

9/9

You might also like