[ncl-talk] cd_calendar bug
Alan Brammer
abrammer at albany.edu
Wed Feb 17 15:08:45 MST 2016
1 month since 2006-01 is 2006-02
0 month since 2006-01 would be 2006-01
If the time value starts at 1 then cd_calendar is correct and your problem lies with the file or the expectation from the file.
e.g.
time = 0
time at units = "month since 2006-01"
print(cd_calendar(time, -1))
Variable: unnamed (return)
Type: integer
Total Size: 4 bytes
1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
Number Of Attributes: 1
calendar : standard
(0) 200601
Good luck,
Alan
##############################
Alan Brammer,
Post-Doc Researcher
Department of Atmospheric and Environmental Sciences,
University at Albany, State University of New York, Albany, NY, 12222
abrammer at albany.edu
##############################
> On 17 Feb 2016, at 16:55, Sitan Heyl <heylsitan at gmail.com> wrote:
>
> Hi,
> when I use below code, I found the return yyyy is wrong. the time value is 1, 2, 3... its unit is month since 2006-01, but the return value from cd_calendar is 200602, not 200601. Please check cd_calendar function.
>
> Best,
> Yongli
>
> f=addfile("rcp45/BCC-CSM1.1/tas_Amon_bcc-csm1-1_rcp45_r1i1p1_200601_210012.nc","r")
> time=f->time
> yyyy=cd_calendar(time,-1)
> print(yyyy(0:13))
>
> ====================
> Variable: yyyy (subsection)
>
> Type: integer
> Total Size: 56 bytes
> 14 values
> Number of Dimensions: 1
> Dimensions and sizes: [14]
> Coordinates:
> Number Of Attributes: 1
> calendar : noleap
> (0) 200602
> (1) 200603
> (2) 200604
> (3) 200605
> (4) 200606
> (5) 200607
> (6) 200608
> (7) 200609
> (8) 200610
> (9) 200611
> (10) 200612
> (11) 200701
> (12) 200702
> (13) 200703
>
> the time variable in file is as below:
>
> float time ( time )
> units : month since 2006-01
> calendar : noleap
> axis : T
> long_name : time
> standard_name : time
> _______________________________________________
> 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/20160217/7c3987fe/attachment.html
More information about the ncl-talk
mailing list