[ncl-talk] incorrect date using cd_calendar (and cd_string)?
Dave Allured - NOAA Affiliate
dave.allured at noaa.gov
Wed Nov 15 15:21:12 MST 2017
Denise,
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.
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.
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.
--Dave
On Wed, Nov 15, 2017 at 1:00 PM, Denise Worthen - NOAA Affiliate <
denise.worthen at noaa.gov> wrote:
> Hi,
>
> 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.
>
> 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.
>
> 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.
>
> 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.
>
> What have I got wrong?
> Denise.
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/cd_string.ncl"
>
> begin
>
> f=addfile("timetest.nc","r")
> timeval=f->time
> timeUnits = f->time at units
> timeCalendar = f->time at calendar
> print(cd_calendar(timeval,0))
> end
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171115/fa5c0020/attachment.html>
More information about the ncl-talk
mailing list