A Brief History of (netCDF) Time

I will attempt to give a little background and describe Unidata's 
recommendation on how time should be stored in netCDF files.

The dimensions of netCDF variables often correspond to coordinates, one 
of which may represent time.  For each "coordinate dimension" there is 
likely to be a variable which carries coordinate values corresponding to 
indices along the dimension.  For example, as shown in the NetCDF Users 
Guide, it is common to have a netCDF dimension named "time" and a singly 
dimensioned netCDF variable with the same name, "time(time)," called a 
coordinate variable.  The ncdump utility has special features for 
displaying the values of coordinate variables.

We believe it is desirable for coordinate values of all kinds to be 
treated similarly.  This allows generic analysis/display packages to 
handle space and time coordinates interchangably, for example, and 
several netCDF-based software packages already do this.  Therefore, we 
have sought ways to represent time that require neither multiple numbers 
nor character strings for each time value.

Our solution exploits: 1) the netCDF capability for assigning a unit of 
measure to each variable, in the form of an attribute, and 2) a nice 
units conversion package, udunits, which is available as a companion 
to the netCDF library.  Units of measure are character strings which 
adhere to the (rather flexible) grammar employed in udunits; when units 
of measure are conformable, udunits may be used to determine the 
relationships between them and perform conversions.  Critical to this 
discussion is the fact that a units descriptor string may contain an 
origin.  The following example is taken from the NetCDF Users Guide:

     time:units = "hours since 1990-11-25 12:00 UTC";

Another example, which corresponds precisely to the standard measure of 
time in UNIX systms, is:

     time:units = "seconds since 1970-1-1";

Similarly, the units may be in years, days, nanoseconds, and so forth.  
With this mechanism, one can store time values in conventional numerical 
formats (integer, real, double, etc.) and meet any accuracy requirement 
we can envision.  For more detail, please see the udunits documentation.

Thus, the Unidata recommendations for representing time values in netCDF 
files are:

 * Store time values in numerically typed variables (not attributes).

 * Assign each such variable its proper unit of measure and origin by 
   using the associated "units" attribute.

 * Values assigned to these "units" attributes should be interpetable by 
   the udunits package.

David Fulker
Unidata Program Center Director
University Corporation for Atmospheric Research
Boulder, Colorado

  • 1993 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: