xdef
and ydef
card in the data
description or .ctl
file (that's why it takes longer to "open"
a preprojected grid data set).
It is very important to point out that the internal
GrADS grid can be any grid as it is completely independent of the preprojected
data grid. Thus, there is nothing stopping you displaying preprojected
data on a very high res lon/lat grid (again, defined in the .ctl
by xdef
and ydef
). In fact, you could create
and open multiple .ctl files with different resolutions and/or regions
which pointed to the same preprojected data file.
When you do a display
(i.e., get a grid of data),
the preprojected data are bilinearly interpolated to the GrADS internal
lat/lon grid. For preprojected scalar fields (e.g., 500 mb heights), the
display is adequate and the precision of the interpolation can be controlled
by xdef
and ydef
to define a higher spatial
resolution grid.
The big virtue of this approach is that all built
in GrADS analytic functions (e.g., aave
, hcurl
...)
continue to work even though the data were not originally on a lon/lat
grid. The downside is that you are not looking directly at your data on
a geographic map. However, one could always define a .ctl file which simply
opened the data file as i,j data and displayed without the map (set
mpdraw
off
). So, in my opinion, this compromise
is not that limiting even if as a modeller you wanted to look at the grid--you
just don't get the map background.
Preprojected vector fields
are
a little trickier, depending on whether the vector is defined relative
to the data grid or relative to the Earth. For example, NMC polar stereo
grids use winds relative to the data grid and thus must be rotated to
the internal GrADS lat/lon grid (again defined in the .ctl
file by the xdef
and ydef
cards).
The only potential problem with working with preprojected
data is defining the projection for GrADS. This is accomplished using
a pdef
card in the data descriptor .ctl
file.
pdef
card is:
pdef isize jsize projtype ipole jpole lonref
gridinc
pdef 53 45 nps 27 49 -105 190.5
where,
ipole
and jpole
are the
(i,j) of the pole referenced from the lower left corner at (1,1) and gridinc
is the dx in km.
A typical NORAPS Lambert-Conformal grid is described below, including the C code which sets up the internal interpolation.
The pdef record for a typical NORAPS Lambert-Conformal grid might
be:
pdef 103 69 lcc 30 -88 51.5 34.5 20 40 -88 90000 90000
where,
103
= #pts in x 69
= #pts in y lcc
= Lambert-Conformal 30
= lat of ref point 88
= lon of ref point (E is positive,
W is negative) 51.5
= i of ref point 34.5
= j of ref point 20
= S true lat 40
= N true lat 88
= standard lon 90000 
= dx in M 90000 
= dy in M
Wind rotation has also been added so that vector data will be properly displayed.
The pdef card for a typical eta model grid is:
pdef 181 136 eta.u -97.0 41.0 0.38888888 0.37037037
181
= #pts
in x
136
= #pts
in y
eta.u
= eta grid, unstaggered
-97.0
= lon of ref point (E is positive
in GrADS, W is negative) [deg]
41.0
= lat of ref point
[deg]
0.3888
= dlon [deg]
0.37037
= dlat [deg]
Wind rotation has not been implemented!!! Use only for scalar fields.
pdef ni nj pse slat slon polei polej dx dy sgn
ni
= # points in x
nj
=
# points in y
slat
= absolute value of the
standard latitude
slon
= absolute value of the
standard longitude
pse
= polar stereo,
"eccentric"
polei
= x index position of the pole (where
(0,0) is the index of the first point vice the more typical (1,1) )
polej
= y index position of the pole (where
(0,0) is the index of the first point vice the more typical (1,1) )
dx
=
delta x in km
dy
=
delta y in km
sgn
= 1 for N polar
stereo and -1 for S polar stereo
Source code in GrADS for the lon,lat -> i,j mapping:
pdef 26 16 ops 40.0 -100.0 90000.0 90000.0 14.0 9.0 180000.0 180000.0
26
= #pts in x
16
= #pts in y
ops
= oblique polar stereo
40.0
= lat of ref point (14.0, 9.0)
-100.0
= lon of ref point (14.0,
9.0 (E is positive in GrADS, W is negative)
90000.0
= xref offset [m]
90000.0
= yref offset [m]
14.0
= i of ref point
9.0
= j of ref point
180000.0
= dx [m]
180000.0
= dy [m]
u
and v
components must be 33
and 34
(the GRIB
standard) respectively, e.g.,
u 15 33
u component of the wind at 15 pressure
levels v 15 34
v component of the wind at 15 pressure
levels
eta.u
and ops
projection are still
experimental...
i,j
space, transformed to the display device coordinates
(e.g., the screen) and then displayed. That is, the i,j of the graphic element
is converted to lat/lon
and then to x,y
on the screen
via a map projection.
GrADS currently supports four display projections
:
set mproj
nps
);
set mproj
sps
);
As you can probably appreciate, the i,j-to-lon/lat-to-screen x,y for lon/lat
displays is very simple and is considerably more complicated for N and S polar
stereo
projections.
In principle, a Lambert Conformal display projection could be implemented. It just takes work and a simple user interface for setting up that display projection. Actually, the user interface (i.e., "set" calls) is the most difficult problem...