<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/nclscripts/contrib/cd_string.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/ut_string.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/ut_string_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/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/">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">      </span>[3]</div><div>Coordinates: </div><div>Number Of Attributes: 2</div><div>  calendar :<span style="white-space:pre">   </span>standard</div><div>  units :<span style="white-space:pre">    </span>hours since 2000-01-01 00:00:00</div><div>(0)<span style="white-space:pre">    </span>23375.86666666664</div><div>(1)<span style="white-space:pre">  </span>23376.33333333331</div><div>(2)<span style="white-space:pre">  </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">  </span>[3]</div><div>Coordinates: </div><div>Number Of Attributes: 1</div><div>  _FillValue :<span style="white-space:pre"> </span>missing</div><div>(0)<span style="white-space:pre">    </span>2002-08-31_23:51:60</div><div>(1)<span style="white-space:pre">        </span>2002-09-01_00:19:60</div><div>(2)<span style="white-space:pre">        </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">    </span>[3]</div><div>Coordinates: </div><div>Number Of Attributes: 1</div><div>  _FillValue :<span style="white-space:pre"> </span>missing</div><div>(0)<span style="white-space:pre">    </span>2002-08-31_23:51:60</div><div>(1)<span style="white-space:pre">        </span>2002-09-01_00:19:60</div><div>(2)<span style="white-space:pre">        </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">        </span>[3]</div><div>Coordinates: </div><div>Number Of Attributes: 1</div><div>  _FillValue :<span style="white-space:pre"> </span>missing</div><div>(0)<span style="white-space:pre">    </span>2002-08-31_23:51:60</div><div>(1)<span style="white-space:pre">        </span>2002-09-01_00:19:60</div><div>(2)<span style="white-space:pre">        </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="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></div>