Cross Sections

## 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:

`set xlabs lab1 | lab2 | lab3 ...
set ylabs lab1 | lab2 | lab3 ...
`

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:

`set xlabs | | | | lab1 | ...
`

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)'
`