Re: cd_calendar returns 12 values instead of 1

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Mon Oct 01 2012 - 11:34:12 MDT

No, that's not right. A closer look at the indices shows that the
same calendar dates are recycling every 30 or 31 time steps. It is as
if the same month number got stuck. Try print (YYYYMMDD) in addition
the other two, and see if you can spot a pattern of defect. Time
coordinates in a well behaved data file should be monotonically
increasing. HTH.

--Dave

On Mon, Oct 1, 2012 at 11:26 AM, Dave Allured <dave.allured@noaa.gov> wrote:
> Try print (f->time) and print (TIME). My guess is that either all 12
> values of the original time coordinates are identical, or else you
> have sub-daily data, 12 different hours/minutes on the same calendar
> date.
>
> --Dave
>
> On Mon, Oct 1, 2012 at 1:03 AM, Almami Johnson <almamij@gmail.com> wrote:
>> Dear all,
>>
>> Trying to get some daily data over a specific time period. After applying
>> cd_calendar, it returns 12 values instead one 1 for iStrt and for iLast. Of
>> course, I got an error like this:
>>
>> (0) 730 4383
>> (1) 761 4414
>> (2) 790 4442
>> (3) 821 4473
>> (4) 851 4503
>> (5) 882 4534
>> (6) 912 4564
>> (7) 943 4595
>> (8) 974 4626
>> (9) 1004 4656
>> (10) 1035 4687
>> (11) 1065 4717
>> fatal:Illegal Subscript. Only scalar values are allowed in subscript ranges.
>>
>> Here is the portion of the code. Could you please help me on this? Thanks.
>>
>> undef("getPrecip")
>> function getPrecip(fname[1]:string,ymStrt[1]:integer,ymLast[1]:integer,
>> vname[1]:string)
>> local TIME, YYYYMM, iStrt, iLast, x
>>
>> begin
>> f = addfile(fname, "r")
>> TIME = f->time
>> YYYYMMDD = cd_calendar(TIME, -2) ; convert
>> iStrt = ind(ymStrt.eq.YYYYMMDD) ; index of start time
>> iLast = ind(ymLast.eq.YYYYMMDD) ; last time
>>
>> print(" " + iStrt + " " + iLast)
>>
>> x = f->$vname$(iStrt:iLast,{-5:25},{-10:10}) ; read specified
>> time period
>>
>> _______________________________________________
>> 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 1 19:34:21 2012

This archive was generated by hypermail 2.1.8 : Tue Oct 02 2012 - 13:38:41 MDT