Using GrADS Station Data

This section describes some of the GrADS commands and functions that are available for analyzing and displaying station data. Please refer to the companion section About Station Data for information on the structure of station data files, how to create them, and how to instruct GrADS to interpret them properly.

Here are some quick links for skipping through this section:


Operating on Station Data

Currently, station data operations and display are supported for three distinct dimension environments:

Operations may be done on station data as with gridded data. Operations between grids and station data are not supported.

Operations between station data are defined as being the operation performed on data points that have exactly the same varying dimension values.

For example, if T is the only varying dimension, the expression:

display ts-ds

would result in a time series of station data reports being retrieved for two separate variables. Then, for station reports having exactly the same time, the operation is performed. Note that duplicates are ignored, with the operation being performed between the first occurrences encountered.

When both X and Y are both fixed dimensions, the variable specification may include a station identifier, which specifies a local override for both lat and lon.

The syntax for this would be:

varname(stid=ident)

The station identifiers are case insensitive.

Some functions do not support station data types. These are:

hdivg hcurl vint maskout ave aave tloop

When X and Y are varying, station data values are displayed as numbers centred at their locations. If two expressions are supplied on the display command (ie, display ts;ds) then two values are displayed, above and below the station location. The display is controlled by the following set commands:

The set stid command controls whether the station identifier is displayed with each value.

Plotting Station Models

GrADs will plot station models from station data. This is enabled by:

set gxout model

The appropriate display command is:

display u;v;t;d;slp;delta;cld;wx;vis

where:

When any of these items are missing (other than u and v), the model is plotted without that element. To represent a globally missing value, enter a constant in the display command. For example, if the delta were always missing, use:

display u;v;t;d;slp;0.0;cld

The station models respond to the usual set commands such as set digsiz, set dignum, set cthick, set ccolor.

In addition, there is set mdlopts which gives the option to plot the number in the slp location as a three digit number, with only the last three digits of the whole number plotted. This allows the standard 3 digit sea level pressure to be plotted by enabling dig3 and plotting slp*10.

Drawing Arbitrary Cross Sections

Drawing arbitrary vertical cross sections based on a collection of station data profiles involves transforming station data (scattered observations) into gridded data so as to take advantage of the GrADS grid display and analysis features.

The first step is to form a collection of 1-D data (Z or T varying). The collect command saves station data profiles or time series in memory as a set. The 1-D data may be either real station data or gridded data converted to station data using gr2stn.

The second stop is to convert the collection of station data into a grid for display or analysis purposes. This is accomplished by the new function coll2gr.

coll2gr does not yet support time slices; currently, it will only work when the collection of stations is a collection of vertical profiles.

coll2gr produces an output grid that varies in X and Z; the dimension environment used when coll2gr is invoked must also be X and Z varying. The X axis of the output grid will contain the equally spaced station profiles and will span the range of the current X dimension environment. The Z axis of the output grid will span the range of the current Z dimension environment and will have either the specified number of levels or a union of the levels. Data points outside of the range of levels will be used for interpolating to within the range if appropriate.

The X axis of the output grid from coll2gr is artificial in terms of the world coordinates -- it doesn't really represent longitudes. A way to completely control the labelling of the display output is provided:

Each label string may include blanks. The labels will be plotted equally spaced along the indicated axis. Spacing can be modified by adding blank strings:

Here is a sample script written by M. Fiorino that uses these features:

*********************************************************************
* The following lines will display an arbitrary X section
* from one specified point to another.
*
* lon1 is the westernmost longitude point
* lon2 is the easternmost longitude point
* lat1 is the latitude that corresponds to lon1
* lat2 is the latitude that corresponds to lon2
*
* The loop is used to interpolate between points in
* the arbitrary cross section. This code will plot
* any cross section as long as you specify the points.
* My code plots cross sections of PV after I calculated
* PV on 11 pressure surfaces. I have another script
* that plots cross sections of potential temperature, and
* the code is very similar to this, except theta is substituted
* for PV.
*
* Many thanks to Brian Doty at COLA for his help with this code.
*
********************************************************************

'open pv.ctl'
'set grads off'
'set zlog on'
'set x 1'
'set y 1'
'set lev 1000 100'
lon1 = -95.0
lon2 = -90.0
lat1 = 55.0
lat2 = 15.0
lon = lon1
'collect 1 free'
while (lon <= lon2)
  lat = lat1 + (lat2-lat1)*(lon-lon1) / (lon2-lon1)
  'collect 1 gr2stn(pv,'lon','lat')'
  lon = lon + 1
endwhile

'set x 14 16'
'set xaxis 'lon1' 'lon2
'set clab on'
'set gxout shaded'
'set clevs 0 .5 15'
'set ccols 0 0 7 0'
'd coll2gr(1,-u)'
'set gxout contour'
'set cint .5'
'd coll2gr(1,-u)'