<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">1 month since 2006-01 is 2006-02</div><div class=""><br class=""></div><div class="">0 month since 2006-01 would be 2006-01</div><div class=""><br class=""></div><div class="">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.&nbsp;</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">e.g.</div><div class=""><div class=""><br class=""></div><div class="">time = 0</div><div class="">time@units = "month since 2006-01"</div><div class="">print(cd_calendar(time, -1))</div><div class=""><br class=""></div><div class="">Variable: unnamed (return)</div><div class="">Type: integer</div><div class="">Total Size: 4 bytes</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1 values</div><div class="">Number of Dimensions: 1</div><div class="">Dimensions and sizes:<span class="Apple-tab-span" style="white-space:pre">        </span>[1]</div><div class="">Coordinates:</div><div class="">Number Of Attributes: 1</div><div class="">&nbsp; calendar :<span class="Apple-tab-span" style="white-space:pre">        </span>standard</div><div class="">(0)<span class="Apple-tab-span" style="white-space:pre">        </span>200601</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Good luck,&nbsp;</div><div class="">Alan&nbsp;</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class="Apple-style-span" style="border-collapse: separate; line-height: normal; border-spacing: 0px;"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">##############################<br class="">Alan Brammer,<div class="">Post-Doc Researcher</div><div class=""><br class=""></div><div class="">Department of Atmospheric and&nbsp;Environmental Sciences,<br class="">University at Albany,&nbsp;State University of New&nbsp;York,&nbsp;Albany, NY, 12222<div class=""><a href="mailto:abrammer@albany.edu" class="">abrammer@albany.edu</a><br class="">##############################</div></div></div></span></div></div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On 17 Feb 2016, at 16:55, Sitan Heyl &lt;<a href="mailto:heylsitan@gmail.com" class="">heylsitan@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi,<div class="">&nbsp; &nbsp;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.&nbsp;</div><div class=""><br class=""></div><div class="">Best,</div><div class="">Yongli</div><div class=""><br class=""></div><div class="">







f=addfile("rcp45/BCC-CSM1.1/tas_Amon_bcc-csm1-1_rcp45_r1i1p1_200601_210012.nc","r")<br class="">time=f-&gt;time</div><div class="">yyyy=cd_calendar(time,-1)<br class="">print(yyyy(0:13))<br class=""><br class="">====================<br class="">Variable: yyyy (subsection)<br class=""><br class="">Type: integer<br class="">Total Size: 56 bytes<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 14 values<br class="">Number of Dimensions: 1<br class="">Dimensions and sizes: &nbsp; [14]<br class="">Coordinates: <br class="">Number Of Attributes: 1<br class="">&nbsp; calendar : &nbsp; &nbsp;noleap<br class="">(0) &nbsp; &nbsp; 200602<br class="">(1) &nbsp; &nbsp; 200603<br class="">(2) &nbsp; &nbsp; 200604<br class="">(3) &nbsp; &nbsp; 200605<br class="">(4) &nbsp; &nbsp; 200606<br class="">(5) &nbsp; &nbsp; 200607<br class="">(6) &nbsp; &nbsp; 200608<br class="">(7) &nbsp; &nbsp; 200609<br class="">(8) &nbsp; &nbsp; 200610<br class="">(9) &nbsp; &nbsp; 200611<br class="">(10) &nbsp; &nbsp;200612<br class="">(11) &nbsp; &nbsp;200701<br class="">(12) &nbsp; &nbsp;200702<br class="">(13) &nbsp; &nbsp;200703<br class=""></div><div class=""><br class=""></div>the time variable in file is as below:<div class=""><br class="">float time ( time )<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;units : &nbsp; &nbsp; &nbsp; &nbsp;month since 2006-01<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;calendar : &nbsp; &nbsp; noleap<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;axis : T<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;long_name : &nbsp; &nbsp;time<br class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;standard_name : &nbsp; &nbsp; &nbsp; &nbsp;time</div></div>
_______________________________________________<br class="">ncl-talk mailing list<br class=""><a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a><br class="">List instructions, subscriber options, unsubscribe:<br class="">http://mailman.ucar.edu/mailman/listinfo/ncl-talk<br class=""></div></blockquote></div><br class=""></div></body></html>