Re: ut_inv_calendar with 360_day calendar

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu, 23 Jul 2009 13:34:49 -0600 (MDT)

Andrew,

It looks like internally, the code for ut_inv_calendar is not
initalizing the variable "udu_lib_version", and hence the error.

It also appears that a work-around is to call "ut_calendar" first,
with dummy code, because this routine *does* initialize
udu_lib_version, and it is carried over when you call ut_inv_calendar.

Try adding these 3 lines before you call ut_inv_calendar:

   dum_time = 17522904
   dum_time_at_units = "hours since 1-1-1 00:00:0.0"
   dum_date = ut_calendar(dum_time, 0)

I've contacted the developer of this code, and hopefully we can get
this fixed shortly. It's only an issue if you use a non-gregorian
calendar.

--Mary

On Thu, 23 Jul 2009, Andrew Dawson wrote:

> The following code causes NCL to exit:
>
> units = "days since 1978-09-01 00:00:00"
> opt = 0
> opt_at_calendar = "360_day"
> time0 = ut_inv_calendar(1978,11,1,0,0,0,units,opt)
>
> If I do not set the calendar attribute of opt then there is no problem.
>
> Andrew
>
> Mary Haley wrote:
>> Andrew,
>>
>> Udunits is built into NCL, so you shouldn't need to install any
>> additional Udunits software.
>>
>> To answer your question, we need more information: how are you
>> trying to call ut_inv_calendar, what are you passing to it, what are
>> you setting "opt" to, what is "units" set to, etc.
>>
>> --Mary
>>
>>
>> On Thu, 23 Jul 2009, Andrew Dawson wrote:
>>
>>> Hi,
>>>
>>> I am new to NCL and am trying to use ut_inv_calendar with a 360_day
>>> calendar and I get the following error which causes NCL to exit:
>>>
>>> Error, udu_lib_version not set to value value: -1
>>>
>>> I am using NCL 5.1.1 on Mac OS X 10.5.7. I'm not sure what this error
>>> really means. I have tried installing udunits from MacPorts but I still
>>> get the same error.
>>>
>>> Does anyone have any idea how to correct this?
>>>
>>> Thanks,
>>> Andrew
>>>
>>> -------------------------------------------------------
>>> Andrew Dawson
>>> School of Mathematics
>>> University of East Anglia
>>> Norwich
>>> Norfolk NR4 7TJ, UK
>>>
>>> Email: andrew.dawson_at_uea.ac.uk
>>> Website: http://www.uea.ac.uk/~bfj07nku
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jul 23 2009 - 13:34:49 MDT

This archive was generated by hypermail 2.2.0 : Wed Jul 29 2009 - 09:07:41 MDT