[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20031219: udunits: year 0



Rick,

You are correct.  There is no year 0.  Year 1 BCE is immediately
followed by year 1 CE.

The UDUNITS package is consistent with this fact.  Other packages might
not be.

Regards,
Steve Emmerson

> To: address@hidden
> cc: Rick Grubin <address@hidden>
> From: Rick Grubin <address@hidden>
> Subject: udunits: year 0
> Organization: NCAR/SCD
> Keywords: UDUNITS
>
> Howdy
> 
> I'm trying to help an NCL user debug a date/time issue that involves using
> udunits.  The user is using Matlab to write a netCDF formatted file, with a
> particular timestamp:
> 
> Matlab:
> 
>  DATENUM Serial date number.
>     N = DATENUM(S) converts the string S into a serial date number.
>     Date numbers are serial days where 1 corresponds to 1-Jan-0000.
>     [...]
>     N = DATENUM(Y,M,D) return the serial date numbers for corresponding
>     elements of the Y,M,D (year,month,day) arrays.
> 
> >> n = datenum('15-Dec-2001')
> 
> n =
> 
>       731200
> 
> >> m = datenum(2001,12,15)
> 
> m =
> 
>       731200
> 
> 
> -and-
> 
> 
>  DATEVEC Date components.
>     C = DATEVEC(T) separates the components of date strings and date
>     numbers into date vectors containing [year month date hour mins secs]
>     [...] 
>     [Y,M,D,H,MI,S] = DATEVEC(T) returns the components of the date
>     vector as individual variables.
> 
> >> c = datevec(731200)       
> 
> c =
> 
>         2001          12          15           0           0           0
> 
> -----------------------
> 
> Within NCL, where the version of udunits library in place is v1.12.0, the
> user takes his Matlab-created netCDF file and (in essence) does:
> 
> ncl 0> time = 731200
> ncl 1> time@units = "Days since 0-1-1 00:00:00"
> ncl 2> print (ut_calendar(time, 0))
> 
> and sees
> 
> (0,0)   2002
> (0,1)   12
> (0,2)   15
> (0,3)    0
> (0,4)    0
> (0,5)    0
> 
> 
> I'm trying to figure out where the extra year that NCL/udunits
> reports comes from.  Is it a safe assumption that year "0" (or "0000")
> doesn't exist?  My long-time (and perhaps muddled) thinking says there is
> no "year 0."

> Thanks,
> -Rick.
> --
> Rick Grubin                     Visualization + Enabling Technologies
> Scientific Computing Division   National Center for Atmospheric Research   
> address@hidden                 303.497.1832