[ncl-talk] Issue with cd_inv_calendar return values

Mary Haley haley at ucar.edu
Thu Jul 30 10:12:40 MDT 2015


Hi Saji,

There are definitely issues when getting down to the seconds level, because
the internal C code doesn't consistently handle the case where you have a
seconds that are an even multiple of 60. Sometimes it "resets" to 0 and
increases the minute value by one, and sometimes it doesn't. I have a note
in to the developers of this code, but haven't heard anything yet.

I can't say for certain that ut_inv_calendar handles this better, but if
it's working for you, and you don't need special calendars, then you should
be okay.

--Mary

On Wed, Jul 22, 2015 at 7:54 PM, Saji Hameed <saji.nh at gmail.com> wrote:

> Hi Kyle,
>
> Thanks.
>
> > How are you calling cd_inv_calendar in your code? Are you certain that
> partial days (e.g., hours, minutes, and/or seconds not equal to 0) aren't >
> being fed into the function?
>
> There is no issue with the parameters that I pass on to cd_inv_calendar,
> but one can never be absolutely sure. The hours, minutes and seconds are
> always 0 in my case.  Since then I have switched back to ut_inv_calendar
> and do not face the same problem again.
>
> > I've used this function countless times with "hours since xxx" and "days
> since xxxx" and never experienced the issue you are describing.
>
> Sure - this happens rarely. I guess it  must be some kind of memory leak
> issue. The funny thing is that I am not able to simulate this "error"
> by using a test script.
>
> saji
>
> On Wed, Jul 22, 2015 at 11:13 PM, Kyle Griffin <ksgriffin2 at wisc.edu>
> wrote:
>
>> Hi Saji,
>>
>> How are you calling cd_inv_calendar in your code? Are you certain that
>> partial days (e.g., hours, minutes, and/or seconds not equal to 0) aren't
>> being fed into the function? I've used this function countless times with
>> "hours since xxx" and "days since xxxx" and never experienced the issue you
>> are describing.
>>
>>
>> Kyle
>>
>> ----------------------------------------
>> Kyle S. Griffin
>> Department of Atmospheric and Oceanic Sciences
>> University of Wisconsin - Madison
>> Room 1421
>> 1225 W Dayton St, Madison, WI 53706
>> Email: ksgriffin2 at wisc.edu
>>
>> On Tue, Jul 21, 2015 at 6:32 AM, Saji Hameed <saji.nh at gmail.com> wrote:
>>
>>> Dear NCL developers,
>>>
>>> I have a library that uses cd_inv_calendar for some critical parts. Once
>>> in a blue moon, my
>>> script crashes due to problems with values returned by cd_inv_calendar.
>>> Instead of returning
>>> a whole number (for example 37785 days since 1900-01-01 return value is
>>> double), it sometimes returns a fraction (37784.xxxx).
>>>
>>> I use NCL version 6.3.0 on a Linux box.
>>>
>>> It is quite difficult to reproduce this issue because it happens rarely
>>> and randomly. I notice that
>>> http://www.ncl.ucar.edu/current_release.shtml#KnownBugs6.3.0  notes a
>>> bug with cd_calendar when the units are specified as "minutes since" or
>>> "seconds since".  In my case the units are
>>> "days since 1900-01-01".
>>>
>>> I will use ut_calendar for the time being, but thought that I would
>>> notify the developers about this issue.
>>>
>>> saji
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150730/2d8dd0e5/attachment-0001.html 


More information about the ncl-talk mailing list