- To: netcdf-java@xxxxxxxxxxxxxxxx
- Subject: Re: [netcdf-java] Date precision while aggregating data
- From: Bob Simons <Bob.Simons@xxxxxxxx>
- Date: Fri, 16 May 2008 09:01:15 -0700
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. <>< <>< <>< <>< <>< <>< <>< <>< <><
- Follow-Ups:
- Re: [netcdf-java] Date precision while aggregating data
- From: Rich Signell
- Re: [netcdf-java] Date precision while aggregating data