Re: 2D grids...

John Sheldon (jps@gfdl.gov)
Wed, 26 Mar 1997 16:56:26 -0500 (EST)

Gary and Arlindo,

> > I was wondering if there was any way in the netCDF standard to have a 2-d dim-
> > ension grid, ie, N "coordinates" each of which is a lat-lon pair, and then each
> > field is defined on that grid.
> 
> Yes, I did something like this for the UWM/COADS data set (see CDL
> below). The problem is that no software appear able to read it
> directly. In retrospect, I believe it was a mistake, we should have
> adopted something like the COARDS conventions (which I don't whether it
> existed back in 1990).

Actually, this idea goes back quite a way.  The concept of "referential
attributes" was laid out in a report from the NetCDF Users Working
Group (NUWG) back in 1992.  You can get this report at

    http://www.unidata.ucar.edu/software/netcdf/NUWG/draft.html

Basically, referential attributes allow you to associate one or more
variables with the coordinates of another variable.  From the NUWG
document:

    The referential concept is also useful in the ... problem with
     hybrid grids which contain a relative vertical coordinate "z". An
     example is where a vertical level of a grid point value may be
     related to pressure, in variable "p", or to the virtual potential
     temperature in variable "vpt".  So the referential attribute can
     be used as follows:

        float u(record, z, x, y);
                u:z = "vpt, p";

    This defines for grid value u(1,2,1,1) that the value for the "z"
    dimension of "u" can be found in p(1,2,1,1) or vpt(1,2,1,1).

    In a simpler case, where the grid is defined for set levels, we can
    define such referential attributes as:

        dimensions:
                z = 3;
        variables:
                float u(record,z,x,y);
                      u:z = "levels";
                float levels(z);
        data:
                levels = 1000.0, 850.0, 500.0;

If you think about it a minute, you'll see that this is the same thing
you want to do to specify the X and Y coordinates of a string of
points.  Arlindo's solution was almost there, needing only the
following attribute:

	      clm: npoint = "lon, lat" ;

Now, there is, admittedly, little software out there which takes
advantage of referential attributes.  But at least if the concept is
accepted, there is at least some basis for being able to handle it.

The COARDS conventions were developed circa 1995, and the idea of
referential attributes was brought up.  I believe that, at the time,
the philosophy was to keep things simple for the first go-round, though
future enhancements might include such a concept.  In fact, we plan to
use it to help document information related to time averaged quantities
stored as netCDF.

Hope that helps!

John P. Sheldon 

(jps@gfdl.gov) 
Geophysical Fluid Dynamics Laboratory/NOAA 
Princeton University/Forrestal Campus/Rte. 1 
P.O. Box 308 
Princeton, NJ, USA  08542

(609) 987-5053 office
(609) 987-5063 fax