Re: cd_calendar problem

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Sat Nov 05 2011 - 18:00:10 MDT

Ziqiang,

   "This function does not return the correct minutes
   and seconds if the reference time doesn't start at
   minute=0, second=0."

This is in the NCL documentation for cd_calendar. I tested this
with NCL version 6.0.0. The function seems to return the correct
minutes and seconds if the base units are days, hours, minutes, or
seconds. See my attached script and output.

I could not find an example for what you requested. Maybe the note
applies only when using base units of years or months. I do not
have any better explanation, sorry.

--Dave

On 11/5/2011 10:26 AM, JiangZiqiang wrote:
> Dave,
>
> Now, I understand that Base units of "years" and "months" are dangerous.
> And I don't understand that "This function does not return the
> correct minutes
> and seconds if the reference time doesn't start at minute=0, second=0."
> can you give me an example? thanks you
>
> Ziqiang
>
>> Date: Sat, 5 Nov 2011 00:25:51 -0600
>> From: dave.allured@noaa.gov
>> Subject: Re: cd_calendar problem
>> To: zqjiang86@hotmail.com
>> CC: ncl-talk@ucar.edu
>>
>> 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 ca n 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@un its <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 18:00:29 2011

This archive was generated by hypermail 2.1.8 : Tue Nov 08 2011 - 15:54:50 MST