<div dir="ltr"><div class="gmail_default" style="font-size:small">I&#39;ve filed a ticket on this, NCL-2029.  </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">It does seem like they are similar. I think time_to_newtime is an older function, so it may be that we just deprecate that one and go with &quot;cd_convert&quot;.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 7, 2014 at 7:20 AM, Alan Brammer <span dir="ltr">&lt;<a href="mailto:abrammer@albany.edu" target="_blank">abrammer@albany.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">I agree it seems like they could be combined and if one wants to change/keep the calendar it could be attached to the units string as an attribute. As neither version handles this at the moment it shouldn&#39;t affect compatibility. <br><span class="HOEnZb"><font color="#888888"><br></font></span></p><span class="HOEnZb"><font color="#888888">
<p dir="ltr">Alan. <br>
</p></font></span><div class="HOEnZb"><div class="h5">
<div class="gmail_quote">On 7 Oct 2014 06:59, &quot;Carl Schreck&quot; &lt;<a href="mailto:cjschrec@ncsu.edu" target="_blank">cjschrec@ncsu.edu</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Related question... What&#39;s the difference between cd_convert and time_to_newtime? <div><br></div><div>Looking at the code, I think they just handle the metadata a little differently. Notably, time_to_newtime updates the coordinate variable (something I forgot to do when I originally wrote ut_convert). </div><div><br></div><div>Perhaps they should be reconciled into one function and the other one marked as deprecated or as an alias on the website?</div><div><br></div><div>    Carl</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 6, 2014 at 10:55 PM, Lam Hoang <span dir="ltr">&lt;<a href="mailto:lamhpvn@gmail.com" target="_blank">lamhpvn@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi Alan,<br></div>I&#39;m using NCL 6.1.2 and your code works perfectly.<br><br>Variable: t<br>Type: double<br>Total Size: 20440 bytes<br>            2555 values<br>Number of Dimensions: 1<span><br>Dimensions and sizes:    [time | 2555]<br></span>Coordinates: <br>            time: [ 0.5..2554.5]<br>Number Of Attributes: 6<br>  bounds :    time_bnds<span><br>  units :    days since 2006-01-01 00:00:00<br></span>  calendar :    <span style="color:rgb(255,0,0)">noleap</span><br>  axis :    T<br>  long_name :    time<br>  standard_name :    time<br><br>Variable: t<br>Type: double<br>Total Size: 20440 bytes<br>            2555 values<br>Number of Dimensions: 1<span><br>Dimensions and sizes:    [time | 2555]<br></span>Coordinates: <br>            time: [56940.5..59494.5]<br>Number Of Attributes: 6<br>  calendar :    <span style="color:rgb(255,0,0)">noleap</span><span><br>  units :    days since 1850-01-01 00:00:00<br></span>  bounds :    time_bnds<br>  axis :    T<br>  long_name :    time<br>  standard_name :    time<br><br></div>Best regards,<br>Lam<br><div><div><div></div></div></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 7, 2014 at 5:07 AM, Alan Brammer <span dir="ltr">&lt;<a href="mailto:abrammer@albany.edu" target="_blank">abrammer@albany.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>What version of ncl are you using? I just tested a similar few lines of code in 6.1.1 and 6.2.0 and they both copied the calendar attribute as expected. Also have you tried cd_convert() seems to do the same thing? </div><div><br></div><div>However in these tests and looking around I have a strong suspicion there is a significant bug in this function.  In that the code copies the calendar attribute but does not actually make use of it and thus returns the wrong answer disguised as the correct one. </div><div><br></div><div><br></div><div>Attached is my edited code.  load this below a load &quot;....contibuted.ncl&quot; line if you have one and this version of the code will replace the stock version.  A developer will hopefully weigh in with more insight in this. </div><div><br></div><div><br></div><div>Good luck, </div><div><br></div><div>Alan</div><div><br></div><div><br></div><div><br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 3, 2014 at 10:08 PM, Lam Hoang <span dir="ltr">&lt;<a href="mailto:lamhpvn@gmail.com" target="_blank">lamhpvn@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear NCL supporting team,<div>I want to convert the time units from a CMIP5 model to make them unique.</div><div>I try to use time_to_newtime function but unfortunately after convert the time units, the calendar attribute changes to &quot;gregorian&quot; as well. </div><div>What should I do if I want to keep the calendar attribute as the original time variable?</div><div><br></div><div>Regards,</div><div>Lam<br clear="all"><div><br></div><div><br></div><div><div>f = addfile(&quot;./oldtime_psl_day_NorESM1-M_historicalExt_r3i1p1_20060101-20121231.nc&quot;,&quot;r&quot;)</div><div>temp<span style="white-space:pre-wrap">                </span>= f-&gt;psl</div><div>t<span style="white-space:pre-wrap">        </span>= f-&gt;time</div><div><br></div><div>printVarSummary(t)</div><div><p style="margin:0px;font-size:11px;font-family:Menlo">*** Variable: t</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">*** Type: double</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">*** Total Size: 20440 bytes</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">***             2555 values</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">*** Number of Dimensions: 1</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">*** Dimensions and sizes:<span style="white-space:pre-wrap">        </span>[time | 2555]</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">*** Coordinates: </p>
<p style="margin:0px;font-size:11px;font-family:Menlo">***             time: [ 0.5..2554.5]</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">*** Number Of Attributes: 6</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">***   bounds :<span style="white-space:pre-wrap">        </span>time_bnds</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">***   units :<span style="white-space:pre-wrap">        </span>days since 2006-01-01 00:00:00</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">***   <font color="#ff0000">calendar :<span style="white-space:pre-wrap">        </span>noleap</font></p>
<p style="margin:0px;font-size:11px;font-family:Menlo">***   axis :<span style="white-space:pre-wrap">        </span>T</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">***   long_name :<span style="white-space:pre-wrap">        </span>time</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">***   standard_name :<span style="white-space:pre-wrap">        </span>time</p></div><div><br></div><div>t<span style="white-space:pre-wrap">        </span>= time_to_newtime(t, &quot;days since 1850-01-01 00:00:00&quot;)</div><div><br></div><div>printVarSummary(t)<br></div></div><div><br></div><div><p style="margin:0px;font-size:11px;font-family:Menlo">*** Variable: t</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">*** Type: double</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">*** Total Size: 20440 bytes</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">***             2555 values</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">*** Number of Dimensions: 1</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">*** Dimensions and sizes:<span style="white-space:pre-wrap">        </span>[time | 2555]</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">*** Coordinates: </p>
<p style="margin:0px;font-size:11px;font-family:Menlo">***             time: [56978.5..59534.5]</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">*** Number Of Attributes: 6</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">***   <font color="#ff0000">calendar :<span style="white-space:pre-wrap">        </span>gregorian</font></p>
<p style="margin:0px;font-size:11px;font-family:Menlo">***   units :<span style="white-space:pre-wrap">        </span>days since 1850-01-01 00:00:00</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">***   bounds :<span style="white-space:pre-wrap">        </span>time_bnds</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">***   axis :<span style="white-space:pre-wrap">        </span>T</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">***   long_name :<span style="white-space:pre-wrap">        </span>time</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">***   standard_name :<span style="white-space:pre-wrap">        </span>time</p></div><span><font color="#888888"><div><br></div><div><br></div>-- <br>Hoang Phuc Lam<br>Viet Nam National Center of Hydro-Meteorology Forecasting<br>National Hydro-Meteorological Services of Vietnam<br>Mob: +84 12 1616 5258<br>Tel:   <a href="tel:%2B844%2038247002" value="+84438247002" target="_blank">+844 38247002</a><br>Fax:  <a href="tel:%2B844%2038254278" value="+84438254278" target="_blank">+844 38254278</a><br>
</font></span></div></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div></div>
</blockquote></div><br><br clear="all"><br>-- <br>Hoang Phuc Lam<br>Viet Nam National Center of Hydro-Meteorology Forecasting<br>National Hydro-Meteorological Services of Vietnam<br>Mob: +84 12 1616 5258<br>Tel:   <a href="tel:%2B844%2038247002" value="+84438247002" target="_blank">+844 38247002</a><br>Fax:  <a href="tel:%2B844%2038254278" value="+84438254278" target="_blank">+844 38254278</a><br>
</div>
</div></div><br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><br><table border="0" cellpadding="2" cellspacing="2" style="max-width:100%;border-collapse:collapse;border-spacing:0px;color:rgb(51,51,51);font-size:14px;border:3px solid rgb(170,170,170);font-family:Times;line-height:12px;background-color:transparent"><tbody><tr><td align="center" height="71" width="71"><span style="font-size:11px"><span style="font-family:arial,helvetica,sans-serif"><a href="http://www.cicsnc.org/" style="color:rgb(38,58,143);text-decoration:none;font-weight:bold" target="_blank"><img src="http://www.cicsnc.org/assets/images/cicsnc-logo.png" width="96" height="93"></a>  <a href="http://www.researcherid.com/rid/B-8711-2011" target="_blank"><br></a></span></span><br><font size="4"><b style="text-align:start;color:rgb(38,58,143);font-family:arial,helvetica,sans-serif"> <a href="http://www.cyclonecenter.org/" style="color:rgb(38,58,143);text-decoration:none" target="_blank">Cyclone</a></b><a href="http://www.cyclonecenter.org/" style="text-align:start;color:rgb(38,58,143);font-family:arial,helvetica,sans-serif;text-decoration:none" target="_blank">Center.org</a>  </font></td><td valign="top"><span style="font-size:11px"><span style="font-family:arial,helvetica,sans-serif"><b>Carl J. Schreck III, PhD</b><br><b>Research Associate</b><br><a href="http://www.cicsnc.org/" style="color:rgb(38,58,143);text-decoration:none;font-weight:bold" target="_blank">Cooperative Institute for Climate and Satellites NC</a> <br><a href="http://ncsu.edu/" style="color:rgb(38,58,143);text-decoration:none;font-weight:bold" target="_blank">North Carolina State University</a><br><a href="http://ncdc.noaa.gov/" style="color:rgb(38,58,143);text-decoration:none;font-weight:bold" target="_blank">NOAA&#39;s National Climatic Data Center</a><br>151 Patton Ave, Asheville, NC 28801<br>e: </span></span><a href="mailto:cjschrec@ncsu.edu" style="color:rgb(38,58,143);font-family:arial,helvetica,sans-serif;font-size:11px;text-decoration:none;font-weight:bold" target="_blank">cjschrec@ncsu.edu</a><br style="font-family:arial,helvetica,sans-serif;font-size:11px"><span style="font-size:11px"><span style="font-family:arial,helvetica,sans-serif">o: <a href="tel:%2B1%20828%20257%203140" value="+18282573140" target="_blank">+1 828 257 3140</a><br></span></span><a href="http://scholar.google.com/citations?hl=en&amp;user=th8ONEcAAAAJ&amp;view_op=list_works&amp;sortby=pubdate" style="color:rgb(38,58,143);font-family:arial,helvetica,sans-serif;font-size:11px;text-decoration:none;font-weight:bold" target="_blank">Publications</a><br><a href="http://monitor.cicsnc.org/mjo/" style="color:rgb(38,58,143);font-family:arial,helvetica,sans-serif;font-size:11px;text-decoration:none;font-weight:bold" target="_blank">monitor.cicsnc.org/mjo</a><br style="font-family:arial,helvetica,sans-serif;font-size:11px"></td></tr></tbody></table></div>
</div></div>
</blockquote></div>
</div></div><br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>