[ncl-talk] DATES

Andrea Perez andreaperez151 at yahoo.es
Wed Apr 3 13:09:57 MDT 2019


 Output: 

Variable: date_strType: stringTotal Size: 392 bytes            49 valuesNumber of Dimensions: 1Dimensions and sizes: [49]Coordinates: (0) 00Z 09 2004(1) 12Z 11 2004(2) 00Z 14 2004(3) 12Z 16 2004(4) 00Z 19 2004(5) 12Z 21 2004(6) 00Z 24 2004(7) 12Z 26 2004(8) 00Z 29 2004(9) 12Z 31 2004(10) 00Z 03 2004(11) 12Z 05 2004(12) 00Z 08 2004(13) 12Z 10 2004(14) 00Z 13 2004(15) 12Z 15 2004(16) 00Z 18 2004(17) 12Z 20 2004(18) 00Z 23 2004(19) 12Z 25 2004(20) 00Z 28 2004(21) 12Z 30 2004(22) 00Z 02 2004(23) 12Z 04 2004(24) 00Z 07 2004(25) 12Z 09 2004(26) 00Z 12 2004(27) 12Z 14 2004(28) 00Z 17 2004(29) 12Z 19 2004(30) 00Z 22 2004(31) 12Z 24 2004(32) 00Z 27 2004(33) 12Z 29 2004(34) 00Z 02 2004(35) 12Z 04 2004(36) 00Z 07 2004(37) 12Z 09 2004(38) 00Z 12 2004(39) 12Z 14 2004(40) 00Z 17 2004(41) 12Z 19 2004(42) 00Z 22 2004(43) 12Z 24 2004(44) 00Z 27 2004(45) 12Z 29 2004(46) 00Z 01 2004(47) 12Z 03 2004(48) 00Z 06 2004

    En miércoles, 3 de abril de 2019 12:23:14 GMT-6, Toni Klemm <toni-klemm at tamu.edu> escribió:  
 
 Hi Andrea,
Could you include some of your output? That might make it easier to understand what is going wrong.
Toni


Toni Klemm, Ph.D.
Postdoctoral Research AssociateDepartment of Ecosystem Science and ManagementCollege of Agriculture and Life SciencesTexas A&M University, College Station, TXContributor to the Early Career Climate Forum
www.toni-klemm.de | @toniklemm








On Apr 3, 2019, at 1:19 PM, Andrea Perez <andreaperez151 at yahoo.es> wrote:
HI!! 
I'm trying to use print dates in string format, converts  UTreferenceddate to Julian/Gregorian date. Dates are hourly (2004-07-09 to 2004-07-11) and in a netcdf file. 
But the hours and day are wrongs. What can I do??



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" 
 begin
     f1=addfile("MMOUT_DOMAIN3_34_sigma.nc","r")  ;  ; Array to hold month abbreviations. Don't store anything in index  ; '0' (i.e. let index 1=Jan, 2=Feb, ..., index 12=Dec).  ;   month_abbr = (/"","Jul","Aug","Sep", \                    "Oct","Nov","Dec"/)  ;  ; Time values and units.  ;    time = f1->time    time at units = "hours since 2004-07-09 00:00:0.0" ;   utc_date = ut_calendar(time, 0) ; ; Store return information into more meaningful variables. ;   year   = tointeger(utc_date(:,0))    ; Convert to integer for   month  = tointeger(utc_date(:,1))    ; use sprinti    day    = tointeger(utc_date(:,2))   hour   = tointeger(utc_date(:,3))    ; Write out strings in the format "hhZ dd mmm yyyy". ;
   date_str = sprinti("%0.2iZ ", hour) + sprinti("%0.2i ", day) + \              sprinti("%0.4i", year)    print(date_str)  end
_______________________________________________
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/20190403/0af21138/attachment.html>


More information about the ncl-talk mailing list