coordinate systems in netcdf

Jonathan Gregory (jmgregory@meto.gov.uk)
Wed, 02 Jul 1997 16:31:15 +0100 (BST)

Dear Stephen and Russ,

Thanks for your mail/posting. Like Stephen, I am inclined to think that an
attribute on the data variable to indicate its coordinates is more flexible
than a global attribute. We have discussed using the associate attribute
proposed in our convention for this purpose; Bob Drach and I are mostly happy
with this idea, with a couple of reservations:

* It is slightly inefficient, because it has to appear separately on each
relevant data variable. But this inefficiency is not too serious, we don't
think.

* We need a way of clarify to a generic API which are the coordinates it
should use, in case there are several possibilities. A program written for
a specific purpose could have this hard-wired, but a general plotting program,
for instance, needs to be able to work it out.

For example, suppose you have a data variable data(d1,d2,d3) and associated
coordinate variables c1(d1,d2), c2(d1,d2), c3(d1,d3), c4(d1,d2,d3), c5(d1,d4),
c6(d2,d3), c7(d1,d2).  c5 can be discarded because it is an error, as one of
its dimensions is not a dimension of the data variable. What about the others?
Which three should we use for a three-dimensional plot?

Any ideas you have on this would be interesting. At the moment, it seems to
me that a very general application should take a conservative point of view.
It should not use any of the associated axes, but use the basic dimensions as
the axes, as indices if there is no physical coordinate applying to an axis.
A less general application, however, might be fulfilling the function "make
a lat-lon-height plot". Such an application, if it could not find lat, lon
or height (of some kind) among the basic axes, would look at the associated
variables, and use the first one of the appropriate type it came across. In
the case above, it might be that c1 was lat, c2 lon and c4 height, so these
would be the default axes, skipping c3. Since c7 has the same dimensions as
c1, the values of c7 could optionally be provided as an alternative set of
values to label the c1 axis. This is the case with our normal associated
coordinate variables, which are associated to a one-dimensional axis, and
provide an alternative set of labels for that axis.

An additional check that it could impose is that the set of coordinate
variables it comes up with should use all of the dimensions. So, for example,
if c3(d3) was a height axis (and therefore not mentioned in the
associate attribute, as it is a basic dimension), c1(d1,d2) lat and c2(d1,d2)
lon, then c1 c2 c3 is an acceptable set. But if the dimensions of c2 were
(d1,d3), c1 c2 c3 would not be OK, because d2 is not used. Such a condition
would be an error, as it presents a contradiction between trying to find a
lon variable, and using all the dimensions. However, this strays into the
realm of what the application in question is defined to do, so would not
necessarily be appropriate to include in the convention.

Stephen mentioned the question of boundaries for multidimensional coordinates.
Would it be adequate to generalise what we proposed for 1D boundaries? It
seems to me that the natural way to do this would be to append a dimension of
size 2 for each of the coordinate dimensions e.g. the boundaries for c1(d1,d2)
would be in b1(d1,d2,2,2).

I shall not be at work on Thursday or Friday.

Best wishes,

Jonathan