[ncl-talk] cd_inv_calendar question

Dennis Shea shea at ucar.edu
Thu Apr 21 16:46:06 MDT 2016


[1]
>From NCL 6.2.0 onward, you no longer need to load the libraries

[2]

No need for
   data = new((/3/),"string")

The following will automatically create the appropriate array.

data     = (/"090102 000130 ","090102 000132 ","090102 000133 "/)

[3]
tatts at longname   should be    tatts at long_name

[4]

 I think this is a printing issue, I think the calculations are correct.

===

Variable: parm_year
Type: integer
Total Size: 12 bytes
            3 values
Number of Dimensions: 1
Dimensions and sizes:    [3]
Coordinates:
(0)    2002
(1)    2002
(2)    2002
(0)    9 1  2  0  1  30  2002
(1)    9 1  2  0  1  32  2002
(2)    9 1  2  0  1  33  2002

Variable: time
Type: double
Total Size: 24 bytes
            3 values
Number of Dimensions: 1
Dimensions and sizes:    [time | 3]
Coordinates:
            time: [462844890.0000001..462844892.9999999]
Number Of Attributes: 2
  calendar :    standard
  units :    seconds since 1988-01-01 00:00:00


Variable: time
Type: double
Total Size: 24 bytes
            3 values
Number of Dimensions: 1
Dimensions and sizes:    [time | 3]
Coordinates:
            time: [462844890.0000001..462844892.9999999]
Number Of Attributes: 2
  calendar :    standard
  units :    seconds since 1988-01-01 00:00:00
(0)    462844890.0000001
(1)    462844891.9999999
(2)    462844892.9999999






On Tue, Apr 19, 2016 at 3:14 PM, Vollaro, David <dvollaro at albany.edu> wrote:

> 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
> --------------------------
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160421/9992aeee/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DavidVollaro.ncl
Type: application/octet-stream
Size: 937 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160421/9992aeee/attachment.obj 


More information about the ncl-talk mailing list