<div dir="ltr"><div><div><div><div><div><div>Ummm, I don't this is a bug. <br><br>I think the file does not adhere to the Climate and Forecast netCDF convention<br><br></div>[1] CF Convention: calendar attribute<br> <br> <a href="http://cfconventions.org/Data/cf-conventions/cf-conventions-1.6/build/cf-conventions.html#calendar">http://cfconventions.org/Data/cf-conventions/cf-conventions-1.6/build/cf-conventions.html#calendar</a><br><br></div>[2] The recognized <b>calendar </b>attributes are all lower case. No mention is made of 'case insensitivity.'<br></div> As an example: the <b>units </b>attribute is lower case; UNITS, Units etc are <b>*not* </b>recognized.<br><br></div>[3] See attached script. <br><br></div>%> ncl test_time_julian.ncl<br><br>------<br><br>Variable: C<br>Type: float<br>Total Size: 24 bytes<br> 6 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [1] x [6]<br>Coordinates: <br>Number Of Attributes: 1<br> <b>calendar : JULIAN<br>(0,0) 2015<br>(0,1) 5<br>(0,2) 13<br>(0,3) 12</b><br>(0,4) 0<br>(0,5) 0<br>(0) =========<br><br><br>Variable: c<br>Type: float<br>Total Size: 24 bytes<br> 6 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [1] x [6]<br>Coordinates: <br>Number Of Attributes: 1<br> <b>calendar : julian<br>(0,0) 2015<br>(0,1) 4<br>(0,2) 30<br>(0,3) 12</b><br>(0,4) 0<br>(0,5) 0<br><br></div>The latter matches ferret and (more important) DaveA's hand calculation.<br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 15, 2017 at 3:21 PM, Dave Allured - NOAA Affiliate <span dir="ltr"><<a href="mailto:dave.allured@noaa.gov" target="_blank">dave.allured@noaa.gov</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">Denise,<div><br></div><div>Your sample file uses the Julian calendar. In my experience the Julian calendar is rarely used in climate sciences, and software implementations are not well vetted. The best long term solution might be to switch to the Gregorian calendar, if that is not contrary to your current application.</div><div><br></div><div>Also your time base is "hours since 0001-01-01 00:00:00". Using a base date before the Julian to Gregorian change in year 1582 exposes you to a particular kind of software problem. You might get better results if you can switch to a base date in the near past, such as 1900-1-1 or 2000-1-1, regardless of which calendar system is selected.</div><div><br></div><div>For what it's worth, my hand calculation for Julian 17657580 hours since 1-1-1 0:0:0 gets 2015 April 30 12:00. This agrees with your ferret result.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>--Dave</div></font></span><div><div class="h5"><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 15, 2017 at 1:00 PM, Denise Worthen - NOAA Affiliate <span dir="ltr"><<a href="mailto:denise.worthen@noaa.gov" target="_blank">denise.worthen@noaa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:verdana,sans-serif">Hi,</div><div style="font-family:verdana,sans-serif"><br></div><div style="font-family:verdana,sans-serif">I've used ncra to 'record average' a set of netcdf files. When I look at the file using ferret, the date in each file is correctly interpreted. </div><div style="font-family:verdana,sans-serif"><br></div><div style="font-family:verdana,sans-serif">When I use ncl, the dates in the file are interpreted incorrectly, either as a label (using cd_string) or just printing the value using cd_calendar.</div><div style="font-family:verdana,sans-serif"><br></div><div style="font-family:verdana,sans-serif">I've extracted out the time axis for a single timestep and attached it here. The correct value in this case should be april 30 2015.</div><div style="font-family:verdana,sans-serif"><br></div><div style="font-family:verdana,sans-serif">Using the following commands, it shows the date as 5-13-2015. This is also the label I get when using cd_string to label a plot in the original file. </div><div style="font-family:verdana,sans-serif"><br></div><div style="font-family:verdana,sans-serif">What have I got wrong?</div><div style="font-family:verdana,sans-serif">Denise.</div><div style="font-family:verdana,sans-serif"><br></div><div style="font-family:verdana,sans-serif"><br></div>load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/contrib/cd_string.ncl"<br><br>begin<br><br>f=addfile("<a href="http://timetest.nc" target="_blank">timetest.nc</a>","r")<br>timeval=f->time<br>timeUnits = f->time@units<br>timeCalendar = f->time@calendar<br>print(cd_calendar(timeval,0))<br>end</div></blockquote></div></div></div></div></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>