Two problems.
(1) Read in description of this function, under "Caveats":
"This function does not return the correct minutes
and seconds if the reference time doesn't start at
minute=0, second=0."
(2) Base units of "years" and "months" are dangerous with real time
calendars. Both are variable length. Years can be 365 or 366 days.
Months can be 28, 29, 30, or 31 days. Some software defines
"years" and "months" as long term averages. Results are
inconsistent between different calendar dates, and between software
packages.
For best results, always use constant time base units of days,
hours, minutes, or seconds. For example:
x = 365 * 3 + 366 * 2
x@units = "days since 2011-12-31 12:00:00"
print(cd_calendar(x,0))
x = 24 * (31 + 29 + 31 + 30 + 31)
x@units = "hours since 2011-12-31 12:00:00"
print(cd_calendar(x,0))
--Dave
On 11/4/2011 11:02 PM, JiangZiqiang wrote:
> Hello,
>
> when I used function "cd_calendar", right result was not got. why?
> x = 5
> x@units <mailto:x@units> = "years since 2011-12-31 12:56:58"
> print(cd_calendar(x,0))
> x = 5
> x@units <mailto:x@units> = "months since 2011-12-31 12:56:58"
> print(cd_calendar(x,0))
>
> Thanks for your help
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat Nov 5 00:26:11 2011
This archive was generated by hypermail 2.1.8 : Tue Nov 08 2011 - 15:54:50 MST