Re: [netcdf-java] Date precision while aggregating data

While one can debate whether the netCDF libraries should round (not truncate) date/time values stored as doubles to the nearest millisecond (I think they should), or whether it's a bug in Java (I think not - Java does date/time calculations with longs), it doesn't solve the immediate problem of storing date/time values in netCDF files for use with the current netCDF libraries.

I think there is a simple solution: store date/time values with units that allow all of the date/time values to be expressed as integer values (in the mathematical sense). In practice, the values often will need to be calculated as Java longs and stored as Java doubles in netCDF files to gain extra precision, since there is no support for longs in netCDF files.

For example, use "seconds since 1970-01-01T00:00:00Z" if your dates/time data is measure to the nearest second. Or, use milliseconds, minutes, hours, or days, ... as appropriate. Even when millisecond values are stored as doubles and even if the "since" time is in the 1800's, there should be no round-off error and Java and netCDF-java should calculate the dates/times correctly.


Sincerely,

Bob Simons
Satellite Data Product Manager
Environmental Research Division
NOAA Southwest Fisheries Science Center
1352 Lighthouse Ave
Pacific Grove, CA 93950-2079
(831)658-3205
bob.simons@xxxxxxxx

The contents of this message are mine personally and
do not necessarily reflect any position of the
Government or the National Oceanic and Atmospheric
Administration.
<>< <>< <>< <>< <>< <>< <>< <>< <><


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