Re: Time in netCDF

Richard P. Signell (rsignell@crusty.er.usgs.gov)
Wed, 5 Feb 92 8:07:15 EST

NetCDFgroup,

At the USGS here in Woods Hole, we have adopted the same convention for
handling time that
has been used for several decades at the Woods Hole Oceanographic Institution
in their Moored Buoy Data Processing System.

To avoid roundoff errors in time calculations, time is stored as
a NC_LONG, and may have valid units of milliseconds, seconds, minutes,
hours, and days. The time is measured relative to midnight on
a global attribute called base_date,
a three element NC_SHORT which specifies the year,
month and day in Gregorian form. This avoids confusion with different
people's definition of Julian Day (I have seen Julian day starting
either midnight or noon, in 1900, in 1970, etc).

Here is an example CDL for an hourly
time series of temperature starting at 0400 UTC on Dec 5, 1989:

------------------------------
dimensions:
time = 123 ;

variables:
long time(time) ;
time:units = "seconds " ;
float temperature(time) ;

// global attributes:
:latitude = 42.52f ;
:longitude = -70.489998f ;
:base_date = 1989s, 12s, 5s ;

data:

time = 14400, 18000, ..........
}
-----------------------------

Using this convention, you can have any precision you want (down
to whatever time units your netCDF software is designed to recognize)
and you never have problems with roundoff error. This scheme, as
I mentioned above, has been used succesfully for many years...

-- 
Rich Signell               |  rsignell@crusty.er.usgs.gov
U.S. Geological Survey     |  (508) 457-2229  |  FTS 837-4229
Quissett Campus            |  "George promised to be good... 
Woods Hole, MA  02543      |  ... but it is easy for little monkeys to forget."