<div dir="ltr"><div>[1]<br>From NCL 6.2.0 onward, you no longer need to load the libraries<br><br>[2]<br><br>No need for <br> data = new((/3/),"string")<br><br>The following will automatically create the appropriate array.<br><br>data = (/"090102 000130 ","090102 000132 ","090102 000133 "/)<br><br>[3]<br>tatts@longname should be tatts@long_name <br><br>[4]<br><br></div> I think this is a printing issue, I think the calculations are correct.<br><br>===<br><br>Variable: parm_year<br>Type: integer<br>Total Size: 12 bytes<br> 3 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [3]<br>Coordinates: <br>(0) 2002<br>(1) 2002<br>(2) 2002<br>(0) 9 1 2 0 1 30 2002<br>(1) 9 1 2 0 1 32 2002<br>(2) 9 1 2 0 1 33 2002<br><br>Variable: time<br>Type: double<br>Total Size: 24 bytes<br> 3 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [time | 3]<br>Coordinates: <br> time: [462844890.0000001..462844892.9999999]<br>Number Of Attributes: 2<br> calendar : standard<br> units : seconds since 1988-01-01 00:00:00<br><br><br>Variable: time<br>Type: double<br>Total Size: 24 bytes<br> 3 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [time | 3]<br>Coordinates: <br> time: [462844890.0000001..462844892.9999999]<br>Number Of Attributes: 2<br> calendar : standard<br> units : seconds since 1988-01-01 00:00:00<br>(0) 462844890.0000001<br>(1) 462844891.9999999<br>(2) 462844892.9999999<br><br><br><br><div><div><br><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 19, 2016 at 3:14 PM, Vollaro, David <span dir="ltr"><<a href="mailto:dvollaro@albany.edu" target="_blank">dvollaro@albany.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi,</p>
<p><br>
</p>
<p>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 .</p>
<p><br>
</p>
<p>Dave</p>
<p><br>
</p>
<p>----------------------------------- attached code --------------------------</p>
<p>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/ut_string.ncl"<br>
<br>
begin<br>
; time_create<br>
; Modified by djv 10/15/15<br>
<br>
data = new((/3/),"string")<br>
data = (/"090102 000130 ","090102 000132 ","090102 000133 "/)<br>
parm_mon = stringtoint(str_get_cols(data, 0,1))<br>
parm_day = stringtoint(str_get_cols(data, 2,3))<br>
parm_yr = stringtoint(str_get_cols(data, 4,5))<br>
parm_hr = stringtoint(str_get_cols(data, 7,8))<br>
parm_min = stringtoint(str_get_cols(data, 9,10))<br>
parm_sec = stringtoint(str_get_cols(data, 11,12))<br>
parm = True<br>
parm_year = parm_yr + 2000<br>
print(parm_year)<br>
<br>
<br>
tatts = True<br>
tatts@longname = "time"<br>
tatts@units = "seconds since 1988-01-01 00:00:00" <br>
<br>
; ******** generate UT referenced value fo reach time in dataset **********<br>
time = cd_inv_calendar(parm_year,parm_mon,parm_day,parm_hr,parm_min,parm_sec,tatts@units,0) <br>
time!0= "time"<br>
time&time= time<br>
printVarSummary(time)<br>
print(time)<br>
end</p>
<p>-------------------------------- end attached code --------------------------</p>
<p><br>
</p>
<p><br>
</p>
</div>
</div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>