[ncl-talk] cd_inv_calendar question

Vollaro, David dvollaro at albany.edu
Tue Apr 19 15:14:58 MDT 2016


Hi,


I am running NCL 6.3.0 and am trying to create a UT referenced time array using cd_inv_calendar.  I have code to read strings containing Gregorian time.  I break up this string into individual variables and then pass these to cd_inv_calendar.  In a test case I seem to get a truncation error when printing out the time values.  Any insight would be appreciated.  Thanks .


Dave


----------------------------------- attached code --------------------------

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/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/ut_string.ncl"

begin
; time_create
; Modified by djv  10/15/15

  data = new((/3/),"string")
  data = (/"090102 000130 ","090102 000132 ","090102 000133 "/)
  parm_mon = stringtoint(str_get_cols(data, 0,1))
  parm_day = stringtoint(str_get_cols(data, 2,3))
  parm_yr = stringtoint(str_get_cols(data, 4,5))
  parm_hr = stringtoint(str_get_cols(data, 7,8))
  parm_min = stringtoint(str_get_cols(data, 9,10))
  parm_sec = stringtoint(str_get_cols(data, 11,12))
  parm = True
  parm_year =  parm_yr + 2000
  print(parm_year)


    tatts = True
    tatts at longname = "time"
    tatts at units = "seconds since 1988-01-01 00:00:00"

;  ******** generate UT referenced value fo reach time in dataset **********
    time = cd_inv_calendar(parm_year,parm_mon,parm_day,parm_hr,parm_min,parm_sec,tatts at units,0)
    time!0= "time"
    time&time= time
    printVarSummary(time)
    print(time)
end

-------------------------------- end attached code --------------------------


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160419/5c6189cc/attachment.html 


More information about the ncl-talk mailing list