Thanks Scott, the following appears to work:
begin
dtime = 2002030106d
stime = sprintf("%10f",dtime)
ctime = stringtochar(stime)
iyear = stringtointeger(chartostring(ctime(0:3)))
imonth = stringtointeger(chartostring(ctime(4:5)))
iday = stringtointeger(chartostring(ctime(6:7)))
ihour = stringtointeger(chartostring(ctime(8:9)))
print("iyear="+iyear+" imonth="+imonth+" iday="+iday+" ihour="+ihour)
end
So I'm all set, thanks for the suggestion,
--Ben
>
>I believe functions such as sprinti and sprintf will help you with this.
>
>Scott
>
>Ben Foster wrote:
>> ncl-talk:
>>
>> Suppose I have an ncl double, read from a netcdf file, e.g. 2002030106
>> i.e., yyyymmddhh, how do I convert this to a string so I can parse out
>> the date and time to 6 hours on March 1, 2002? Thanks,
>>
>> --Ben
>>
>> -----------------------------------------------------------------------
>> Ben Foster High Altitude Observatory (HAO)
>> foster_at_ucar.edu phone: 303-497-1595 fax: 303-497-1589
>> Nat. Center for Atmos. Res. P.O. Box 3000 Boulder CO 80307 USA
>> -----------------------------------------------------------------------
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk_at_ucar.edu
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>> .
>>
>>
>_______________________________________________
>ncl-talk mailing list
>ncl-talk_at_ucar.edu
>http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-----------------------------------------------------------------------
Ben Foster High Altitude Observatory (HAO)
foster_at_ucar.edu phone: 303-497-1595 fax: 303-497-1589
Nat. Center for Atmos. Res. P.O. Box 3000 Boulder CO 80307 USA
-----------------------------------------------------------------------
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jan 24 2007 - 14:55:04 MST
This archive was generated by hypermail 2.2.0 : Mon Feb 05 2007 - 16:31:09 MST