<div dir="ltr">I remember some discussion on this topic on the list a couple years ago. Although I didn&#39;t find that particular thread, a similar one came to light from 2008 highlighting the problem at hand.<div><br></div><div><a href="https://www.ncl.ucar.edu/Support/talk_archives/2008/0946.html">https://www.ncl.ucar.edu/Support/talk_archives/2008/0946.html</a><br></div><div><br></div><div>If I remember from the last time, the fact that most time values must be doubles costs some precision when it comes to seconds (I didn&#39;t think minutes were affected, although it appears they are indirectly) and the dates are also not accurate in very early years, although for a different reason (prior to the last major shift in the Gregorian calendar, I believe, late 1600s?). </div><div><br></div><div>With increasingly high-resolution datasets (e.g. the &quot;new&quot; HRRR from NCEP - data every 15 minutes, <a href="http://www.nco.ncep.noaa.gov/pmb/products/hrrr/">http://www.nco.ncep.noaa.gov/pmb/products/hrrr/</a>), both spatially and temporally, the minutes portion of this bug might be worth tackling as the potential issues now might be more frequent than they may have been in the past.</div><div><br></div><div><br></div><div>Kyle</div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr">----------------------------------------<div>Kyle S. Griffin</div><div>Department of Atmospheric and Oceanic Sciences</div><div>University of Wisconsin - Madison</div><div>Room 1421</div><div>1225 W Dayton St, Madison, WI 53706</div><div>Email: <a href="mailto:ksgriffin2@wisc.edu" target="_blank">ksgriffin2@wisc.edu</a></div></div></div>
<br><div class="gmail_quote">On Mon, Oct 13, 2014 at 11:48 PM, Mary Haley <span dir="ltr">&lt;<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.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 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&#39;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"><div><div class="h5">On Fri, Oct 10, 2014 at 9:43 AM, Jared Lee <span dir="ltr">&lt;<a href="mailto:jaredlee@ucar.edu" target="_blank">jaredlee@ucar.edu</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>Hi, I believe I&#39;ve found a bug in the cd_string function in NCL v6.2.0 (I&#39;m running on NCAR&#39;s Yellowstone supercomputer).  It seems like it&#39;s possibly a rounding error.  Here&#39;s sample code to demonstrate the bug:<br><br>=====<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/contrib/cd_string.ncl&quot;<br><br>begin<br>do testMin = 0, 60, 1<br>   testMin@units = &quot;minutes since 2014-01-01 00:00:00&quot;<br>   print(&quot;testMin = &quot;+testMin+&quot; -&gt; &quot;+cd_string(testMin, &quot;%N/%D/%Y, %H:%M:%S&quot;))<br>end do<br>do testSec = 0, 3600, 60<br>   testSec@units = &quot;seconds since 1970-01-01 00:00:00&quot;<br>   print(&quot;testSec = &quot;+testSec+&quot; -&gt; &quot;+cd_string(testSec, &quot;%N/%D/%Y, %H:%M:%S&quot;))<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 &quot;00&quot;, and sometimes returns a value of &quot;60&quot;.  This means that sometimes the minutes value is not correct, which is problematic for my applications, where I&#39;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 -&gt; 01/01/2014, 00:00:00<br>(0)    testMin = 1 -&gt; 01/01/2014, 00:00:60<br>(0)    testMin = 2 -&gt; 01/01/2014, 00:01:60<br>(0)    testMin = 3 -&gt; 01/01/2014, 00:02:60<br>(0)    testMin = 4 -&gt; 01/01/2014, 00:03:60<br>(0)    testMin = 5 -&gt; 01/01/2014, 00:04:60<br>(0)    testMin = 6 -&gt; 01/01/2014, 00:05:60<br>(0)    testMin = 7 -&gt; 01/01/2014, 00:06:60<br>(0)    testMin = 8 -&gt; 01/01/2014, 00:08:00<br>(0)    testMin = 9 -&gt; 01/01/2014, 00:09:00<br>(0)    testMin = 10 -&gt; 01/01/2014, 00:10:00<br>(0)    testMin = 11 -&gt; 01/01/2014, 00:11:00<br>(0)    testMin = 12 -&gt; 01/01/2014, 00:12:00<br>(0)    testMin = 13 -&gt; 01/01/2014, 00:13:00<br>(0)    testMin = 14 -&gt; 01/01/2014, 00:14:00<br>(0)    testMin = 15 -&gt; 01/01/2014, 00:15:00<br>(0)    testMin = 16 -&gt; 01/01/2014, 00:15:60<br>(0)    testMin = 17 -&gt; 01/01/2014, 00:16:60<br>(0)    testMin = 18 -&gt; 01/01/2014, 00:17:60<br>(0)    testMin = 19 -&gt; 01/01/2014, 00:18:60<br>(0)    testMin = 20 -&gt; 01/01/2014, 00:19:60<br>(0)    testMin = 21 -&gt; 01/01/2014, 00:20:60<br>(0)    testMin = 22 -&gt; 01/01/2014, 00:21:60<br>(0)    testMin = 23 -&gt; 01/01/2014, 00:23:00<br>(0)    testMin = 24 -&gt; 01/01/2014, 00:24:00<br>(0)    testMin = 25 -&gt; 01/01/2014, 00:25:00<br>(0)    testMin = 26 -&gt; 01/01/2014, 00:26:00<br>(0)    testMin = 27 -&gt; 01/01/2014, 00:27:00<br>(0)    testMin = 28 -&gt; 01/01/2014, 00:28:00<br>(0)    testMin = 29 -&gt; 01/01/2014, 00:29:00<br>(0)    testMin = 30 -&gt; 01/01/2014, 00:30:00<br>(0)    testMin = 31 -&gt; 01/01/2014, 00:30:60<br>(0)    testMin = 32 -&gt; 01/01/2014, 00:31:60<br>(0)    testMin = 33 -&gt; 01/01/2014, 00:32:60<br>(0)    testMin = 34 -&gt; 01/01/2014, 00:33:60<br>(0)    testMin = 35 -&gt; 01/01/2014, 00:34:60<br>(0)    testMin = 36 -&gt; 01/01/2014, 00:35:60<br>(0)    testMin = 37 -&gt; 01/01/2014, 00:36:60<br>(0)    testMin = 38 -&gt; 01/01/2014, 00:38:00<br>(0)    testMin = 39 -&gt; 01/01/2014, 00:39:00<br>(0)    testMin = 40 -&gt; 01/01/2014, 00:40:00<br>(0)    testMin = 41 -&gt; 01/01/2014, 00:41:00<br>(0)    testMin = 42 -&gt; 01/01/2014, 00:42:00<br>(0)    testMin = 43 -&gt; 01/01/2014, 00:43:00<br>(0)    testMin = 44 -&gt; 01/01/2014, 00:44:00<br>(0)    testMin = 45 -&gt; 01/01/2014, 00:45:00<br>(0)    testMin = 46 -&gt; 01/01/2014, 00:45:60<br>(0)    testMin = 47 -&gt; 01/01/2014, 00:46:60<br>(0)    testMin = 48 -&gt; 01/01/2014, 00:47:60<br>(0)    testMin = 49 -&gt; 01/01/2014, 00:48:60<br>(0)    testMin = 50 -&gt; 01/01/2014, 00:49:60<br>(0)    testMin = 51 -&gt; 01/01/2014, 00:50:60<br>(0)    testMin = 52 -&gt; 01/01/2014, 00:51:60<br>(0)    testMin = 53 -&gt; 01/01/2014, 00:53:00<br>(0)    testMin = 54 -&gt; 01/01/2014, 00:54:00<br>(0)    testMin = 55 -&gt; 01/01/2014, 00:55:00<br>(0)    testMin = 56 -&gt; 01/01/2014, 00:56:00<br>(0)    testMin = 57 -&gt; 01/01/2014, 00:57:00<br>(0)    testMin = 58 -&gt; 01/01/2014, 00:58:00<br>(0)    testMin = 59 -&gt; 01/01/2014, 00:59:00<br>(0)    testMin = 60 -&gt; 01/01/2014, 01:00:00<br>(0)    testSec = 0 -&gt; 01/01/1970, 00:00:00<br>(0)    testSec = 60 -&gt; 01/01/1970, 00:00:60<br>(0)    testSec = 120 -&gt; 01/01/1970, 00:02:00<br>(0)    testSec = 180 -&gt; 01/01/1970, 00:03:00<br>(0)    testSec = 240 -&gt; 01/01/1970, 00:03:60<br>(0)    testSec = 300 -&gt; 01/01/1970, 00:04:60<br>(0)    testSec = 360 -&gt; 01/01/1970, 00:06:00<br>(0)    testSec = 420 -&gt; 01/01/1970, 00:07:00<br>(0)    testSec = 480 -&gt; 01/01/1970, 00:07:60<br>(0)    testSec = 540 -&gt; 01/01/1970, 00:08:60<br>(0)    testSec = 600 -&gt; 01/01/1970, 00:10:00<br>(0)    testSec = 660 -&gt; 01/01/1970, 00:11:00<br>(0)    testSec = 720 -&gt; 01/01/1970, 00:11:60<br>(0)    testSec = 780 -&gt; 01/01/1970, 00:12:60<br>(0)    testSec = 840 -&gt; 01/01/1970, 00:14:00<br>(0)    testSec = 900 -&gt; 01/01/1970, 00:15:00<br>(0)    testSec = 960 -&gt; 01/01/1970, 00:15:60<br>(0)    testSec = 1020 -&gt; 01/01/1970, 00:17:00<br>(0)    testSec = 1080 -&gt; 01/01/1970, 00:18:00<br>(0)    testSec = 1140 -&gt; 01/01/1970, 00:18:60<br>(0)    testSec = 1200 -&gt; 01/01/1970, 00:19:60<br>(0)    testSec = 1260 -&gt; 01/01/1970, 00:21:00<br>(0)    testSec = 1320 -&gt; 01/01/1970, 00:22:00<br>(0)    testSec = 1380 -&gt; 01/01/1970, 00:22:60<br>(0)    testSec = 1440 -&gt; 01/01/1970, 00:23:60<br>(0)    testSec = 1500 -&gt; 01/01/1970, 00:25:00<br>(0)    testSec = 1560 -&gt; 01/01/1970, 00:26:00<br>(0)    testSec = 1620 -&gt; 01/01/1970, 00:26:60<br>(0)    testSec = 1680 -&gt; 01/01/1970, 00:27:60<br>(0)    testSec = 1740 -&gt; 01/01/1970, 00:29:00<br>(0)    testSec = 1800 -&gt; 01/01/1970, 00:30:00<br>(0)    testSec = 1860 -&gt; 01/01/1970, 00:30:60<br>(0)    testSec = 1920 -&gt; 01/01/1970, 00:32:00<br>(0)    testSec = 1980 -&gt; 01/01/1970, 00:33:00<br>(0)    testSec = 2040 -&gt; 01/01/1970, 00:33:60<br>(0)    testSec = 2100 -&gt; 01/01/1970, 00:34:60<br>(0)    testSec = 2160 -&gt; 01/01/1970, 00:36:00<br>(0)    testSec = 2220 -&gt; 01/01/1970, 00:37:00<br>(0)    testSec = 2280 -&gt; 01/01/1970, 00:37:60<br>(0)    testSec = 2340 -&gt; 01/01/1970, 00:38:60<br>(0)    testSec = 2400 -&gt; 01/01/1970, 00:40:00<br>(0)    testSec = 2460 -&gt; 01/01/1970, 00:41:00<br>(0)    testSec = 2520 -&gt; 01/01/1970, 00:41:60<br>(0)    testSec = 2580 -&gt; 01/01/1970, 00:42:60<br>(0)    testSec = 2640 -&gt; 01/01/1970, 00:44:00<br>(0)    testSec = 2700 -&gt; 01/01/1970, 00:45:00<br>(0)    testSec = 2760 -&gt; 01/01/1970, 00:45:60<br>(0)    testSec = 2820 -&gt; 01/01/1970, 00:47:00<br>(0)    testSec = 2880 -&gt; 01/01/1970, 00:48:00<br>(0)    testSec = 2940 -&gt; 01/01/1970, 00:48:60<br>(0)    testSec = 3000 -&gt; 01/01/1970, 00:49:60<br>(0)    testSec = 3060 -&gt; 01/01/1970, 00:51:00<br>(0)    testSec = 3120 -&gt; 01/01/1970, 00:52:00<br>(0)    testSec = 3180 -&gt; 01/01/1970, 00:52:60<br>(0)    testSec = 3240 -&gt; 01/01/1970, 00:53:60<br>(0)    testSec = 3300 -&gt; 01/01/1970, 00:55:00<br>(0)    testSec = 3360 -&gt; 01/01/1970, 00:56:00<br>(0)    testSec = 3420 -&gt; 01/01/1970, 00:56:60<br>(0)    testSec = 3480 -&gt; 01/01/1970, 00:57:60<br>(0)    testSec = 3540 -&gt; 01/01/1970, 00:59:00<br>(0)    testSec = 3600 -&gt; 01/01/1970, 01:00:00<br>=====<br clear="all"><div><div><br></div><div>Is there an easy fix to this bug?<span><font color="#888888"><br><br></font></span></div><span><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></div></div>_______________________________________________<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>
<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>