DaniSb170 / nctoolbox

Automatically exported from code.google.com/p/nctoolbox
0 stars 0 forks source link

nctoolbox.time does not correctly resolve time for dates outside the Gregorian calendar #6

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

In Matlab:
ds = 
nctoolbox('dods://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/ncep.reanalysis/s
urface_gauss/vwnd.10m.gauss.2009.nc')
t = ds.time('time')
datestr(t(1))  % Produces 03-Jan-2009 00:00:00 but we expect 01-Jan-2009 
00:00:00  

What is the expected output? What do you see instead?

The units in the dataset for time are  "hours since 1-1-1 00:00:0.0". The 
toolbox does correctly convert time for units that fall within the Gregorain 
calendar, for example units of "seconds since 1970-01-01T00:00:00Z"

This is the note we received from ESRL regarding this: 

"The 48 hour error is typical when naively applying the 4/100/400 year rule for 
leap days with our older files whose origin data precedes the 
Gregorian Era.  I'm told that NOAA's Pacific Marine Environment Laboratory 
(PMEL, www.pmel.noaa.gov) has a Matlab package called "MexEPS" that 
correctly interprets our udunits-based times.  Outside of that, I'm only aware 
of two packages that get it right:  Numerical Recipes, and the udunits  
from Unidata: www.unidata.ucar.edu/software/udunits) library itself.  And, of 
course, packages which use these, such as "GrADS" (grads.iges.org).  
The chlorophyll file has an origin time that is within the Gregorian Era, so 
the 4/100/400 year rule for leap days works."

Original issue reported on code.google.com by bschlin...@gmail.com on 23 Feb 2010 at 6:19

GoogleCodeExporter commented 8 years ago
Applied a fix to ncdataset.m. I'm using the ucar.nc2.units package to resolve 
time. This 
correctly convertes the dates in the demos as well as the problem dataset at 
dods://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/ncep.reanalysis/surface_gaus
s
/vwnd.10m.gauss.2009.nc. I'll roll this change out ASAP

Original comment by bschlin...@gmail.com on 23 Feb 2010 at 6:20

GoogleCodeExporter commented 8 years ago
Fix was released in nctoolbox-20100223

Original comment by bschlin...@gmail.com on 23 Feb 2010 at 6:30