GFDL - Geophysical Fluid Dynamics Laboratory

Lucas Harris’s GrADS scripts

GrADS is great for doing exactly what it wants you to do, but sometimes a bit of flexibility is needed. Thankfully GrADS is quite extensible if you know how. Here are some examples:

draw_grid.gs: This was specifically made to draw the edges of a cubed-sphere grid, although it can draw lines between any list of latitude-longitude points you give to it. Typically I use a script, grid-rip.sh, which takes a set of files as arguments (typically the grid_spec files output by FMS), uses NCO to tear out the boundary points of the grid and writes them to an ascii file. draw_grid then takes as an argument that ascii file, as well as an optional color for the lines:

draw_grid file [color_number]

and then draws lines between successive points on top of the current plot.

For example: to create a plot of 2000 day averaged surface pressure from a nested Held-Suarez integration (in these files; untar and put into the same directory as these other scripts), you would first create the ascii boundary files from the grid_spec files

 > grid-rip.sh grid_spec*.nc

The boundary files in this case have names like c48xc48*.out .

The script HS-test.gs will then make the plots using draw_grid.gs. Make it executable by running chmod +x HS-test.gs, and then type ./HS-test.gs at the command line to run it. When you’re done, type ‘quit’ or press Control-D to quit GrADS.

 

draw_label.gs: This places a label in the upper-left-hand corner of the current plot, complete with an opaque background so the map contours do not obscure the label.

draw_label text

An example of its usage can be seen in HS-test.gs (uncomment out the appropriate line in the script). Unfortunately this script does not allow options like string size and color to be supplied at the GrADS command line, but the hard-coded values can be fiddled with.