Coordinate Systems: Definitions and Examples

John Caron (caron@ucar.edu)
Fri, 11 Jul 1997 16:29:09 -0600

This is a multi-part message in MIME format.

--------------2D8519A169D8
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Here is a document attempting to make formal definitions and concrete
examples for our discussion on coordinate variables. It's best to read
it in a browser at
	http://acd.ucar.edu/~caron/coordvar.html
but i also have attached a plain text version of it.

My intention is that we might evolve both the definitions and examples
as we go along, in a way that gives us a common language to speak about
our various proposals. So I hope to at least try to make the definitions
and examples independent of any implementation proposal.  I can add any
other contributions for now; if it gets controversial, perhaps Russ or
some other "neutral" party might be willing to do it.  

I hope you find these useful.

--------------2D8519A169D8
Content-Type: text/plain; charset=us-ascii; name="coordvar.html"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="coordvar.html"

Coordinate Variables in Netcdf

Draft 7/11/97 by John Caron, with help from Brian Eaton and Russ Rew

----------------------------------------------------------------------------

  1. Formal definitions, supposedly independent of proposals for
     conventions.
  2. Motivating examples, check proposals against these.

----------------------------------------------------------------------------

Definitions

The following tries to make formal definitions using the language of
abstract algebra. A standard reference is Algebra, Saunders MacLane and
Garrett Birkhoff, The Macmillan Company, 1967.

A dimension, d, is a named range of integers: d = {0,1,..size-1} (or d =
{1,2,..size} if you prefer). A dimension is completely specified by the pair
(name, size).

An index domain, D, is a set constructed from the cartesian product of one
or more dimensions: D = d1 x d2 x .. x dn, where di are dimensions. The
points of D are thus tuples of integers. A projection Dp of D is a cartesian
product of a subset of the dimensions {di} that D is constructed from. (So a
point in Dp is just a point in D with 0, 1, or more indices missing). We
will also call the function p that maps D to Dp a projection of D.

A variable is a function v(D) -> R, where D is an index domain, v denotes
the function, and R is the range or codomain. In the context of netcdf
files, we represent functions as scalar arrays, and so are limited to
directly representing only scalar functions. The range of a scalar function
is any of the possible data types of a netcdf variable: double, int, string,
etc.

A vector function is an ordered list of scalar functions with the same
domain, called component functions. A vector function thus maps points in D
to a tuple of values of its component scalar functions.   In practice the
component functions may have domains that are projections of D. Formally
this is done by composing the component function with a projection function:
cf_formal = cf_actual * p, where * is functional composition and p is the
projection function which maps D to the domain of cf_actual.

A coordinate system is a vector function that assigns unique physical values
to the points in its domain. It thus maps an n-tuple of integers in "index
space" to an m-tuple of reals, strings, etc. in "physical space", called a
location. This mapping must be one-to-one. Formally, we can write a
coordinate system as a function Cs(D) -> R, or equivalently Cs(D) = (C1(D),
C2(D), ...,Cm(D)) -> (R1, R2, ..., Rm), where Ci(D) -> Ri is the ith scalar
coordinate function. The values of the coordinate functions are the
coordinates of the coordinate system.

For a variable v(Dv) -> Rv, and coordinate system Cs(Ds) -> Rs, Cs may be a
coordinate system for variable v when Ds is a projection of Dv. When Ds =
Dv, Cs is a complete coordinate system for v, since then Cs assigns a unique
location to every value of v.

A spatial coordinate system is a coordinate system whose locations are in
3-dimensional space. A georeferencing coordinate system is a spatial
coordinate system which provides enough information to place its locations
in reference to the earth. A temporal coordinate system is one which
provides enough information to place its locations in real, physical time.

----------------------------------------------------------------------------

Motivating Examples

Here are a number of examples that would be useful to cover in a general
coordinate system convention. I will use a shorthand to indicate the form of
the coordinate functions, rather than cdl syntax to indicate a proposed
convention. The idea is to test any proposal against these examples.

  1. classic coordinate variables:

     var(lat, lon)

          lat(lat)

          lon(lon)

  2. scattered points; assign them a location:

     var(npoints)

          lat(npoints)

          lon(npoints)

  3. projective geometry:

     var(lat, lon)

          lat(lat,lon)

          lon(lat,lon)

     however, I think we could be clearer about this. var(lat, lon) isn't
     really correct; its really a function of (x,y) on a projection surface.
     So better is:

     var(x, y)

          x(x)

          y(y)

          lat(x,y)

          lon(x,y)

  4. hybrid coordinates:

     var(lon, lat, lev)

          lat(lat)

          lon(lon)

          lev(lon, lat, lev)

     again, we're being vague; really we are describing two alternative lev
     coordinates: hybrid(lev) and pressure(lon, lat, lev) so we can rewrite
     as:

     var(lon, lat, hybrid)

          lon(lon)

          lat(lat)

          hybrid(hybrid)

          pressure(lon, lat, hybrid)

  5. edge coordinates, level is some kind of altitude coordinate:

     var(level)

          lev_bottom(level)

          lev_top(level)

  6. non- georeferencing coordinates. Up to now, all the examples have been
     georeferencing coordinates. A different coordinate system that we use
     in radiative transfer codes is

     var(lev, wavelength)

  7. vector valued variables, for example:

     vector(lev, 3)

     velocity(lat,lon,component)

          component(3) = "u", "v", "w"

  8. correlations, using a dimension more than once:

     corr_var( npoints, npoints)

          lat(npoints)

          lon(npoints)

     which may or may not be clearer than:

     corr_var(lat, lon, lat, lon)

          lat(lat)

          lon(lon)

     Its worth specifying what we mean by the first example. We can do so
     precisely by specifying fully the coordinate system as a vector
     function, and explicitly state the domains of the coordinate functions:

          Cs(np x np) = (lat(np,), lon(np,), lat(,np), lon(,np)) -> (lat1,
          lon1, lat2, lon2)

  9. a balloon or airplane trajectory:

     temperature(time)

     ch4(time)

          lat(time)

          lon(time)

          elevation(time)

 10. moving coordinate system. For example, satellite images tracking a
     tropical hurricane keep the coordinate system centered on the hurricane
     as it moves:

     pressure(time, x, y)

          lat(time, x, y)

          lon(time, x, y)

 11. multiple time coordinates:

     var(time)

          year(time)

          day_of_year(time)

          second_of_day(time)

     and the famous NUWG case:

     var(time)

          generate_time(time)

          valid_time(time)

--------------2D8519A169D8--