Re: Problems Using ut_calendar

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon, 20 Oct 2008 21:47:56 -0600

Katie

Using Dave's code ...

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "./substring.ncl"
load "./find_substring.ncl"
load "./calendar_decode2.ncl"
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

begin
   f = addfile("time_noleap.nc" , "r")
   time = f->time

   YMDH = calendar_decode2(time, 0)
   print(YMDH)
end

yields

Variable: YMDH
Type: float
Total Size: 175200 bytes
             43800 values
Number of Dimensions: 2
Dimensions and sizes: [7300] x [6]
Coordinates:
Number Of Attributes: 1
   _FillValue : -999
(0,0) 1981
(0,1) 1
(0,2) 1
(0,3) 12
(0,4) 0
(0,5) 0

(1,0) 1981
(1,1) 1
(1,2) 2
(1,3) 12
(1,4) 0
(1,5) 0
[snip]

=====

Dave Allured wrote:
> Katie,
>
> Here is a calendar function that should do what you want. It
> substitutes for ut_calendar, and is called with the same arguments. It
> supports several common CF calendars, including "no leap". This code is
> somewhat vetted because my work group has used it for several projects:
>
> http://www.cdc.noaa.gov/people/dave.allured/data/lib/ncl/
>
> The main function is calendar_decode2.ncl. There are a number of
> restrictions when used with non-gregorian calendars; please see the
> documentation header. Your program will need to load the two small
> support functions in advance of the main function.
>
> Also please note that Saji Hameed of APEC Climate Center, Korea,
> published a calendar function about a year ago, that supported the no
> leap calendar. For your reference, I have included a copy of Saji's
> code in the same directory.
>
> http://www.ncl.ucar.edu/Support/talk_archives/2007/1400.html
>
> Dave Allured
> CU/CIRES Climate Diagnostics Center (CDC)
> http://cires.colorado.edu/science/centers/cdc/
> NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
> http://www.cdc.noaa.gov/
>
> Katie Holman wrote:
>> I am looking at GCM data that has the time units in "days since
>> 0000-01-01 00:00:00". The attribute time:calendar = "no leap" so I
>> have been explicitly changing that attribute in the script to
>> "standard" because the ut_calendar() doesn't support the "no leap"
>> calendar type. I am sure the first day of the file is 01-01-1981 (by
>> using the ncdump command and actually calculating it). When I use the
>> ut_calendar function, the first output value says 09-06-1980. Since I
>> know that the output isn't correct, do you have any suggestions of why
>> this is happening? The second alternative is that I should be using a
>> different function in NCL. There is another function called
>> ut_convert ... should I be using this one perhaps? If neither is a
>> good choice, is there something else I should be looking for on the
>> website?
>>
>>
>> Thank you,
>> Katie Holman
>> UW-Madison Grad Student
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Oct 20 2008 - 21:47:56 MDT

This archive was generated by hypermail 2.2.0 : Sat Dec 20 2008 - 12:36:21 MST