# Re: Coordinate Systems Proposals

John Caron (caron@ucar.edu)
Thu, 10 Jul 1997 12:14:47 -0600

Hi John:

> A simple example, first where the coordinate info is attached to a
> specific data variable:
>
>   dimensions:
>         lon = 6 ;
>         lat = 5 ;
>         height = 30;
>
>   variables:
>         float TEMP(height, lat, lon) ;
>               TEMP:lon="lon_coords" ;
>               TEMP:lat="lat_coords" ;
>         float lon_coords(lat,lon) ;
>         float lat_coords(lat,lon) ;
>
> Suppose we want to plot/analyze/examine/etc. variable "TEMP".  We
> immediately see it is a 6x5x3 array of values.  Then, we want to find
> out more about the coordinates corresponding to the datapoints of
> "TEMP".  There are no variables "lon" and "lat", so we simply take the
> coordinates to be "1,2,3,..." along each axis.
>
> So what else can we deduce?  The rule for referential attributes is
> that when there is a variable attribute by the same name as one of the
> variable's dimensions, that attribute contains the name(s) of other
> variables from which to get spatio-temporal coordinates for that
> dimension.  In this case, the longitudes can be obtained from variable
> "lon_coords".  When we go to look at "lon_coords", we see that it is
> 2-D, so we match up which dimensions it has in common with TEMP.  This
> tells us that the longitudes for TEMP(*,j,i) are in lon_coords(j,i).
> Likewise for latitudes.

I think we all agree on the meaning of this example, and we are trying
to decide on the best way to convey that meaning to an application, or a
person reading our netcdf files who hasnt followed our discussion.

A coordinate variable says "the variable lat is the coordinate function
for the index lat", but in this example you cant say that, nor can you
say "the variables lat_coords, lon_coords are the coordinate functions
for the index lat". What you can say is "the variables lat_coords,
lon_coords are the coordinate functions for the variable TEMP".

I want to claim that (lat, lon) are nothing but indices, and could just
as well be written
(npoints). If theres a coordinate variable lat(lat), then we have some
meaning. So the dimensions aren't fundamental to a coord system, the
coord functions are. So in general, you can't define the coordinate
system in reference to the dimensions (well, you can, but I claim its
not the best).

better is something like:
float TEMP(height, lat, lon) ;
TEMP:coordinates="lon_coords lat_coords" ;
float lon_coords(lat,lon) ;
float lat_coords(lat,lon) ;

although I've come to favor:
float TEMP(height,x,y) ;
TEMP:coordinates="lon_coords lat_coords" ;
float lon_coords(x,y) ;
float lat_coords(x,y) ;