[ncl-talk] Bug in cd_inv_calendar

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Tue Apr 7 18:19:22 MDT 2015


Jared,

Out of curiosity I tried this.  I can not reproduce the bug with NCL 6.2.1
or 6.3.0 on Mac OS 10.10.2, or NCL 6.2.1 on Redhat Linux 6.6.  I get the
expected result of 0, 0, 0 in all cases.  More data points for debugging.

--Dave

On Tue, Apr 7, 2015 at 4:42 PM, Jared Lee <jaredlee at ucar.edu> wrote:

> Hi, I just found a bug in cd_inv_calendar. I'm using NCL v6.3.0 on
> Yellowstone.
>
> I have discovered that if the 'seconds' variable has a @_FillValue
> attribute, then the cd_inv_calendar function will return missing values. If
> that attribute is not present, then the function works properly. The other
> variables ('years', 'months', 'days', 'hours', and 'minutes') can all have
> @_FillValue attributes (or not have them) and the function will work
> properly, also. It's only the 'seconds' input variable that apparently
> cannot have that attribute. Below I've included a simple code and output to
> demonstrate the bug.
>
> Sample code (bug_cd_inv_calendar.ncl):
>
> ************
> load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/cd_string.ncl"
>
> begin
>
> yr = 2006
> mo = 01
> dy = 01
> hr = 00
> mn = 00
> sc = 00
>
> time_units = "hours since 2006-01-01 00:00:00"
>
> time1 = cd_inv_calendar(yr, mo, dy, hr, mn, sc, time_units, 0)
> print(time1)
>
> sc at _FillValue = -999
> time2 = cd_inv_calendar(yr, mo, dy, hr, mn, sc, time_units, 0)
> print(time2)
>
> yr at _FillValue = -999
> mo at _FillValue = -999
> dy at _FillValue = -999
> hr at _FillValue = -999
> mn at _FillValue = -999
> delete(sc at _FillValue)
> time3 = cd_inv_calendar(yr, mo, dy, hr, mn, sc, time_units, 0)
> print(time3)
>
> end
> ************
>
> And here is the output from that sample code:
>
> ************
> -bash-4.1$ ncl < bug_cd_inv_calendar.ncl
>  Copyright (C) 1995-2015 - All Rights Reserved
>  University Corporation for Atmospheric Research
>  NCAR Command Language Version 6.3.0
>  The use of this software is governed by a License Agreement.
>  See http://www.ncl.ucar.edu/ for more details.
>
>
> Variable: time1
> Type: double
> Total Size: 8 bytes
>             1 values
> Number of Dimensions: 1
> Dimensions and sizes:   [1]
> Coordinates:
> Number Of Attributes: 2
>   calendar :    standard
>   units :       hours since 2006-01-01 00:00:00
> (0)        0
>
>
> Variable: time2
> Type: double
> Total Size: 8 bytes
>             1 values
> Number of Dimensions: 1
> Dimensions and sizes:   [1]
> Coordinates:
> Number Of Attributes: 3
>   _FillValue :  9.969209968386869e+36
>   calendar :    standard
>   units :       hours since 2006-01-01 00:00:00
> (0)     9.969209968386869e+36
>
>
> Variable: time3
> Type: double
> Total Size: 8 bytes
>             1 values
> Number of Dimensions: 1
> Dimensions and sizes:   [1]
> Coordinates:
> Number Of Attributes: 3
>   _FillValue :  9.969209968386869e+36
>   calendar :    standard
>   units :       hours since 2006-01-01 00:00:00
> (0)        0
> ***************
>
> Jared
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150407/e36ae5b0/attachment.html 


More information about the ncl-talk mailing list