<div dir="ltr"><div class="gmail_default" style="font-size:small">Jared,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I will try to look into this, but I don't know how soon I can get to it. Does ut_string give you the same problem?</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I think we may already have a ticket on this issue, NCL-1829, so I will add your nice test script to this ticket.</div><div class="gmail_default" style="font-size:small"><br></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 Fri, Oct 10, 2014 at 9:43 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"><div>Hi, I believe I've found a bug in the cd_string function in NCL v6.2.0 (I'm running on NCAR's Yellowstone supercomputer). It seems like it's possibly a rounding error. Here's sample code to demonstrate the bug:<br><br>=====<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/cd_string.ncl"<br><br>begin<br>do testMin = 0, 60, 1<br> testMin@units = "minutes since 2014-01-01 00:00:00"<br> print("testMin = "+testMin+" -> "+cd_string(testMin, "%N/%D/%Y, %H:%M:%S"))<br>end do<br>do testSec = 0, 3600, 60<br> testSec@units = "seconds since 1970-01-01 00:00:00"<br> print("testSec = "+testSec+" -> "+cd_string(testSec, "%N/%D/%Y, %H:%M:%S"))<br>end do<br>end<br>=====<br><br></div>This script gives the following output. Notice that the seconds field sometimes returns a value of "00", and sometimes returns a value of "60". This means that sometimes the minutes value is not correct, which is problematic for my applications, where I'm trying to match a string returned from cd_string with an observation time in a data file (and those, of course, never have 60 in the seconds field). Note also that this is a problem that occurs with different time units. Here is the output:<br><br>=====<br>(0) testMin = 0 -> 01/01/2014, 00:00:00<br>(0) testMin = 1 -> 01/01/2014, 00:00:60<br>(0) testMin = 2 -> 01/01/2014, 00:01:60<br>(0) testMin = 3 -> 01/01/2014, 00:02:60<br>(0) testMin = 4 -> 01/01/2014, 00:03:60<br>(0) testMin = 5 -> 01/01/2014, 00:04:60<br>(0) testMin = 6 -> 01/01/2014, 00:05:60<br>(0) testMin = 7 -> 01/01/2014, 00:06:60<br>(0) testMin = 8 -> 01/01/2014, 00:08:00<br>(0) testMin = 9 -> 01/01/2014, 00:09:00<br>(0) testMin = 10 -> 01/01/2014, 00:10:00<br>(0) testMin = 11 -> 01/01/2014, 00:11:00<br>(0) testMin = 12 -> 01/01/2014, 00:12:00<br>(0) testMin = 13 -> 01/01/2014, 00:13:00<br>(0) testMin = 14 -> 01/01/2014, 00:14:00<br>(0) testMin = 15 -> 01/01/2014, 00:15:00<br>(0) testMin = 16 -> 01/01/2014, 00:15:60<br>(0) testMin = 17 -> 01/01/2014, 00:16:60<br>(0) testMin = 18 -> 01/01/2014, 00:17:60<br>(0) testMin = 19 -> 01/01/2014, 00:18:60<br>(0) testMin = 20 -> 01/01/2014, 00:19:60<br>(0) testMin = 21 -> 01/01/2014, 00:20:60<br>(0) testMin = 22 -> 01/01/2014, 00:21:60<br>(0) testMin = 23 -> 01/01/2014, 00:23:00<br>(0) testMin = 24 -> 01/01/2014, 00:24:00<br>(0) testMin = 25 -> 01/01/2014, 00:25:00<br>(0) testMin = 26 -> 01/01/2014, 00:26:00<br>(0) testMin = 27 -> 01/01/2014, 00:27:00<br>(0) testMin = 28 -> 01/01/2014, 00:28:00<br>(0) testMin = 29 -> 01/01/2014, 00:29:00<br>(0) testMin = 30 -> 01/01/2014, 00:30:00<br>(0) testMin = 31 -> 01/01/2014, 00:30:60<br>(0) testMin = 32 -> 01/01/2014, 00:31:60<br>(0) testMin = 33 -> 01/01/2014, 00:32:60<br>(0) testMin = 34 -> 01/01/2014, 00:33:60<br>(0) testMin = 35 -> 01/01/2014, 00:34:60<br>(0) testMin = 36 -> 01/01/2014, 00:35:60<br>(0) testMin = 37 -> 01/01/2014, 00:36:60<br>(0) testMin = 38 -> 01/01/2014, 00:38:00<br>(0) testMin = 39 -> 01/01/2014, 00:39:00<br>(0) testMin = 40 -> 01/01/2014, 00:40:00<br>(0) testMin = 41 -> 01/01/2014, 00:41:00<br>(0) testMin = 42 -> 01/01/2014, 00:42:00<br>(0) testMin = 43 -> 01/01/2014, 00:43:00<br>(0) testMin = 44 -> 01/01/2014, 00:44:00<br>(0) testMin = 45 -> 01/01/2014, 00:45:00<br>(0) testMin = 46 -> 01/01/2014, 00:45:60<br>(0) testMin = 47 -> 01/01/2014, 00:46:60<br>(0) testMin = 48 -> 01/01/2014, 00:47:60<br>(0) testMin = 49 -> 01/01/2014, 00:48:60<br>(0) testMin = 50 -> 01/01/2014, 00:49:60<br>(0) testMin = 51 -> 01/01/2014, 00:50:60<br>(0) testMin = 52 -> 01/01/2014, 00:51:60<br>(0) testMin = 53 -> 01/01/2014, 00:53:00<br>(0) testMin = 54 -> 01/01/2014, 00:54:00<br>(0) testMin = 55 -> 01/01/2014, 00:55:00<br>(0) testMin = 56 -> 01/01/2014, 00:56:00<br>(0) testMin = 57 -> 01/01/2014, 00:57:00<br>(0) testMin = 58 -> 01/01/2014, 00:58:00<br>(0) testMin = 59 -> 01/01/2014, 00:59:00<br>(0) testMin = 60 -> 01/01/2014, 01:00:00<br>(0) testSec = 0 -> 01/01/1970, 00:00:00<br>(0) testSec = 60 -> 01/01/1970, 00:00:60<br>(0) testSec = 120 -> 01/01/1970, 00:02:00<br>(0) testSec = 180 -> 01/01/1970, 00:03:00<br>(0) testSec = 240 -> 01/01/1970, 00:03:60<br>(0) testSec = 300 -> 01/01/1970, 00:04:60<br>(0) testSec = 360 -> 01/01/1970, 00:06:00<br>(0) testSec = 420 -> 01/01/1970, 00:07:00<br>(0) testSec = 480 -> 01/01/1970, 00:07:60<br>(0) testSec = 540 -> 01/01/1970, 00:08:60<br>(0) testSec = 600 -> 01/01/1970, 00:10:00<br>(0) testSec = 660 -> 01/01/1970, 00:11:00<br>(0) testSec = 720 -> 01/01/1970, 00:11:60<br>(0) testSec = 780 -> 01/01/1970, 00:12:60<br>(0) testSec = 840 -> 01/01/1970, 00:14:00<br>(0) testSec = 900 -> 01/01/1970, 00:15:00<br>(0) testSec = 960 -> 01/01/1970, 00:15:60<br>(0) testSec = 1020 -> 01/01/1970, 00:17:00<br>(0) testSec = 1080 -> 01/01/1970, 00:18:00<br>(0) testSec = 1140 -> 01/01/1970, 00:18:60<br>(0) testSec = 1200 -> 01/01/1970, 00:19:60<br>(0) testSec = 1260 -> 01/01/1970, 00:21:00<br>(0) testSec = 1320 -> 01/01/1970, 00:22:00<br>(0) testSec = 1380 -> 01/01/1970, 00:22:60<br>(0) testSec = 1440 -> 01/01/1970, 00:23:60<br>(0) testSec = 1500 -> 01/01/1970, 00:25:00<br>(0) testSec = 1560 -> 01/01/1970, 00:26:00<br>(0) testSec = 1620 -> 01/01/1970, 00:26:60<br>(0) testSec = 1680 -> 01/01/1970, 00:27:60<br>(0) testSec = 1740 -> 01/01/1970, 00:29:00<br>(0) testSec = 1800 -> 01/01/1970, 00:30:00<br>(0) testSec = 1860 -> 01/01/1970, 00:30:60<br>(0) testSec = 1920 -> 01/01/1970, 00:32:00<br>(0) testSec = 1980 -> 01/01/1970, 00:33:00<br>(0) testSec = 2040 -> 01/01/1970, 00:33:60<br>(0) testSec = 2100 -> 01/01/1970, 00:34:60<br>(0) testSec = 2160 -> 01/01/1970, 00:36:00<br>(0) testSec = 2220 -> 01/01/1970, 00:37:00<br>(0) testSec = 2280 -> 01/01/1970, 00:37:60<br>(0) testSec = 2340 -> 01/01/1970, 00:38:60<br>(0) testSec = 2400 -> 01/01/1970, 00:40:00<br>(0) testSec = 2460 -> 01/01/1970, 00:41:00<br>(0) testSec = 2520 -> 01/01/1970, 00:41:60<br>(0) testSec = 2580 -> 01/01/1970, 00:42:60<br>(0) testSec = 2640 -> 01/01/1970, 00:44:00<br>(0) testSec = 2700 -> 01/01/1970, 00:45:00<br>(0) testSec = 2760 -> 01/01/1970, 00:45:60<br>(0) testSec = 2820 -> 01/01/1970, 00:47:00<br>(0) testSec = 2880 -> 01/01/1970, 00:48:00<br>(0) testSec = 2940 -> 01/01/1970, 00:48:60<br>(0) testSec = 3000 -> 01/01/1970, 00:49:60<br>(0) testSec = 3060 -> 01/01/1970, 00:51:00<br>(0) testSec = 3120 -> 01/01/1970, 00:52:00<br>(0) testSec = 3180 -> 01/01/1970, 00:52:60<br>(0) testSec = 3240 -> 01/01/1970, 00:53:60<br>(0) testSec = 3300 -> 01/01/1970, 00:55:00<br>(0) testSec = 3360 -> 01/01/1970, 00:56:00<br>(0) testSec = 3420 -> 01/01/1970, 00:56:60<br>(0) testSec = 3480 -> 01/01/1970, 00:57:60<br>(0) testSec = 3540 -> 01/01/1970, 00:59:00<br>(0) testSec = 3600 -> 01/01/1970, 01:00:00<br>=====<br clear="all"><div><div><br></div><div>Is there an easy fix to this bug?<span class="HOEnZb"><font color="#888888"><br><br></font></span></div><span class="HOEnZb"><font color="#888888"><div>Jared<br></div><div><br>-- <br><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<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.497.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/jaredlee</a><br>===============================</font><br></div></div>
</div></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>