<div dir="ltr">Oh, and one more thing. The documentation page for ut_string_fix should say to load ut_string_fix.ncl, rather than ut_string.ncl, in order to use the function.<div><br></div><div>Jared</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 22, 2017 at 10:38 AM, Jared Lee <span dir="ltr"><<a href="mailto:jaredlee@ucar.edu" target="_blank">jaredlee@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi, I and others have previously written about the bug in cd_string that results in "60" being written in the seconds place, instead of incrementing the minutes place by 1 and resetting seconds to 0. To address this, ut_string_fix was introduced as a temporary fix. Unfortunately, I am finding the same exact bug in ut_string_fix that is in both cd_string and ut_string. I'll attach my script as a file, but for posterity in the web archives, here's my short demo script, followed by the resulting output, which demonstrates the problem. (The values for time that I specified were copy-pasted from another script where I first discovered this bug.)<div><br></div><div>-----</div><div><div><div>;; bug_ut_string_fix.ncl</div><div><br></div><div>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/contrib/cd_string.<wbr>ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/contrib/ut_string.<wbr>ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/contrib/ut_string_<wbr>fix.ncl"</div><div><br></div><div>time_units = "hours since 2000-01-01 00:00:00"</div><div>time_fmt = "%Y-%N-%D_%H:%M:%S"</div><div><br></div><div>time = (/23375.86666666664d, 23376.33333333331d, 23376.61666666664d/)</div><div>time@units = time_units</div><div>time@calendar = "standard"</div><div>print(time)</div><div><br></div><div>time_ut_string = ut_string(time, time_fmt)</div><div>print(time_ut_string)</div><div>time_ut_string_fix = ut_string_fix(time, time_fmt)</div><div>print(time_ut_string_fix)</div><div>time_cd_string = cd_string(time, time_fmt)</div><div>print(time_cd_string)</div></div><div><br></div><div>-----</div><div><br></div><div>And now here is the output from running the script:</div><div><br></div><div><div>jaredlee@cheyenne5:~/tools/<wbr>nclscripts/NREL_Alaska> ncl bug_ut_string_fix.ncl </div><div> Copyright (C) 1995-2017 - All Rights Reserved</div><div> University Corporation for Atmospheric Research</div><div> NCAR Command Language Version 6.4.0</div><div> The use of this software is governed by a License Agreement.</div><div> See <a href="http://www.ncl.ucar.edu/" target="_blank">http://www.ncl.ucar.edu/</a> for more details.</div><div><br></div><div><br></div><div>Variable: time</div><div>Type: double</div><div>Total Size: 24 bytes</div><div> 3 values</div><div>Number of Dimensions: 1</div><div>Dimensions and sizes:<span style="white-space:pre-wrap"> </span>[3]</div><div>Coordinates: </div><div>Number Of Attributes: 2</div><div> calendar :<span style="white-space:pre-wrap"> </span>standard</div><div> units :<span style="white-space:pre-wrap"> </span>hours since 2000-01-01 00:00:00</div><div>(0)<span style="white-space:pre-wrap"> </span>23375.86666666664</div><div>(1)<span style="white-space:pre-wrap"> </span>23376.33333333331</div><div>(2)<span style="white-space:pre-wrap"> </span>23376.61666666664</div><div><br></div><div><br></div><div>Variable: time_ut_string</div><div>Type: string</div><div>Total Size: 24 bytes</div><div> 3 values</div><div>Number of Dimensions: 1</div><div>Dimensions and sizes:<span style="white-space:pre-wrap"> </span>[3]</div><div>Coordinates: </div><div>Number Of Attributes: 1</div><div> _FillValue :<span style="white-space:pre-wrap"> </span>missing</div><div>(0)<span style="white-space:pre-wrap"> </span>2002-08-31_23:51:60</div><div>(1)<span style="white-space:pre-wrap"> </span>2002-09-01_00:19:60</div><div>(2)<span style="white-space:pre-wrap"> </span>2002-09-01_00:36:60</div><div><br></div><div><br></div><div>Variable: time_ut_string_fix</div><div>Type: string</div><div>Total Size: 24 bytes</div><div> 3 values</div><div>Number of Dimensions: 1</div><div>Dimensions and sizes:<span style="white-space:pre-wrap"> </span>[3]</div><div>Coordinates: </div><div>Number Of Attributes: 1</div><div> _FillValue :<span style="white-space:pre-wrap"> </span>missing</div><div>(0)<span style="white-space:pre-wrap"> </span>2002-08-31_23:51:60</div><div>(1)<span style="white-space:pre-wrap"> </span>2002-09-01_00:19:60</div><div>(2)<span style="white-space:pre-wrap"> </span>2002-09-01_00:36:60</div><div><br></div><div><br></div><div>Variable: time_cd_string</div><div>Type: string</div><div>Total Size: 24 bytes</div><div> 3 values</div><div>Number of Dimensions: 1</div><div>Dimensions and sizes:<span style="white-space:pre-wrap"> </span>[3]</div><div>Coordinates: </div><div>Number Of Attributes: 1</div><div> _FillValue :<span style="white-space:pre-wrap"> </span>missing</div><div>(0)<span style="white-space:pre-wrap"> </span>2002-08-31_23:51:60</div><div>(1)<span style="white-space:pre-wrap"> </span>2002-09-01_00:19:60</div><div>(2)<span style="white-space:pre-wrap"> </span>2002-09-01_00:36:60</div></div><div><br></div><div>-----</div><div><br></div><div>Jared</div><div><br></div>-- <br><div class="m_-8296906176513191530gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div><div><div><div><font face="courier new, monospace">==============================<wbr>=<br>Jared A. Lee, Ph.D.<br></font></div><font face="courier new, monospace">Project Scientist I<br></font></div><font face="courier new, monospace">Research Applications Laboratory<br></font></div><font face="courier new, monospace">National Center for Atmospheric Research<br>Boulder, Colorado, USA</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">Member, AMS Planning Commission<br><br></font></div><font face="courier new, monospace">Email: <a href="mailto:jaredlee@ucar.edu" target="_blank">jaredlee@ucar.edu</a> (w)<br></font></div><font face="courier new, monospace">Phone: <a href="tel:(303)%20497-8485" value="+13034978485" target="_blank">303.497.8485</a> (w)</font><div><font face="courier new, monospace">Web: <a href="https://staff.ucar.edu/users/jaredlee" target="_blank">https://staff.ucar.edu/users/<wbr>jaredlee</a><br>==============================<wbr>=</font><br></div></div></div></div></div>
</div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div><div><div><div><font face="courier new, monospace">===============================<br>Jared A. Lee, Ph.D.<br></font></div><font face="courier new, monospace">Project Scientist I<br></font></div><font face="courier new, monospace">Research Applications Laboratory<br></font></div><font face="courier new, monospace">National Center for Atmospheric Research<br>Boulder, Colorado, USA</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">Member, AMS Planning Commission<br><br></font></div><font face="courier new, monospace">Email: <a href="mailto:jaredlee@ucar.edu" target="_blank">jaredlee@ucar.edu</a> (w)<br></font></div><font face="courier new, monospace">Phone: 303.497.8485 (w)</font><div><font face="courier new, monospace">Web: <a href="https://staff.ucar.edu/users/jaredlee" target="_blank">https://staff.ucar.edu/users/jaredlee</a><br>===============================</font><br></div></div></div></div></div>
</div>