[ncl-talk] calendar_decode2: is this a bug?

Stefan Muthers ncl at z107.de
Wed Nov 19 14:00:19 MST 2014


Dear all,

I have a problem with calendar_decode2 and do not know whether this is a
bug or whether I maybe missunderstand something.

Consider the following example:

--------------------------

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/calendar_decode2.ncl"

a=1
a at units = "months since 1600-01-01 00:00:00"
printVarSummary(a)
;
;Variable: a
;Type: integer
;Total Size: 4 bytes
;            1 values
;Number of Dimensions: 1
;Dimensions and sizes:   [1]
;Coordinates: 
;Number Of Attributes: 1
;units :       months since 1600-01-01 00:00:00

print(""+calendar_decode2(a, -5))
;(0,0)   1600
;(0,1)   1
;(0,2)   31
;(0,3)   10
;(0,4)   29
;(0,5)   3

--------------------------

I would expect the calendar_decode2 function to return 1600-02-01. Why
is 1600-01-31 returned here?

thanks you and best regards,
 Stefan




More information about the ncl-talk mailing list