Re: 2D coordinate variables

Brian Eaton (eaton@merlin.cgd.ucar.EDU)
Mon, 19 May 1997 17:11:28 -0600 (MDT)


I am involved with the effort to design netCDF conventions for the output
of NCAR's Climate Systems Model (CSM) and have been following the
discussion about 2D coordinate variables with interest.  It is an issue not
addressed by the COARDS conventions, and they are the starting point for
the CSM conventions.  Since "referential attributes" have been advanced as
the solution to this problem I would like to make some comments about them.
Finally I would like to support the generalization of the current
definition of coordinate variables to n-D coordinate variables as recently
proposed by John Caron for the 2D case.

The concept of "referential attributes" is not well defined.  In recent
postings to the netCDF group I have seen them used in the following

The first 2 examples are from the document


> The referential concept is also useful in the second 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).

Assuming that p and vpt have been defined by

        float p(record, z, x, y);
        float vpt(record, z, x, y);

then it is implicit that u, p, and vpt are defined on the same grid (this
is one reason for having named dimensions in netCDF) and hence that the
values of p and vpt corresponding to u at gridpoint (1,2,1,1) are given by
p(1,2,1,1) and vpt(1,2,1,1).  The referential attribute z does not provide
any information about the relative vertical coordinate z, e.g., how is it
defined, what are its values, and how are these values related to some
physical variable like pressure.


> 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;

This is exactly the case that 1D coordinate variables handle so well.  This
file should be set up as follows:

                levels = 3;

                float u(record,levels,x,y);
                float levels(levels);

                levels = 1000.0, 850.0, 500.0;

I have recently seen two other examples of how referential attributes are
supposed to work.  In response to a question about representing the
longitudes and latitudes at a collection of points John Sheldon


                npoint = 10;

                float lon(npoint);
                         lon:long_name = "longitude" ;
                         lon:units = "degrees_east" ;
                float lat(npoint);
                         lat:long_name = "latitude" ;
                         lat:units = "degrees_north" ;
                float data(npoint);
                         data:npoint = "lon,lat";

And John Caron has pointed out that the problem the NUWG was attempting to
solve with referential attributes was:


                ntime = 10;

                float ref_time(ntime);
                         ref_time:long_name = "reference time" ;
                         ref_time:units = "hours since 1970-01-01 00:00:00" ;
                float fcst_time(ntime);
                         fcst_time:long_name = "forecast time" ;
                         fcst_time:units = "hours since 1970-01-01 00:00:00" ;
                float data(ntime);
                         data:ntime = "ref_time,fcst_time";

Examples 1 (just considering the z dimension), 3 and 4 use the same syntax
to describe quite different data relationships.

Finally there was the recent suggestion by John Sheldon for using
referential attributes to describe 2D coordinates.  Essentially we have


> dimensions:
>         ni = 4 ;
>         nj = 3 ;
> variables:
>         float mydata(nj,ni) ;
>            mydata:nj = "latarr";
>            mydata:ni = "lonarr";
>         float latarr(ni,nj) ;
>         float lonarr(ni,nj) ;

The data relationships being expressed here are quite different from the
preceeding examples, AND the syntax is different so there is a possibility
of making an unambiguous definition of what is meant by the referential
attributes.  But consider John Caron's suggestion for the same problem:


> dimensions:
>         lat = 4 ;
>         lon = 3 ;
> variables:
>         float lat(lat,lon) ;
>         float lon(lat,lon) ;
>         float mydata(lat,lon) ;

I believe this is a natural generalization of the coordinate variable
concept.  I don't see what the extra level of indirection inherent in
referential attributes buys us, especially in light of the current state of
confusion about what a referential attribute is supposed to represent.

Brian Eaton
NCAR, Climate and Global Dynamics Division.
Boulder, CO.