load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl" dirw = "./" files = systemfunc("ls -1 wrfout_d01_20*") + ".nc" pthw = dirw+files print(pthw) a = addfiles(pthw,"r") x = wrf_user_getvar(a,"slp",-1) ; printVarSummary(x) ; [Time | ??] x [south_north | ??] x [west_east | ??] print("-----") Times = a[:]->Times printVarSummary(Times) ; char Times(Time, DateStrLen) print("-----") print(tostring(Time)) ; Time(Time) ; type string; yyyy-mm-dd_hh:mn:sc print("-----") ;---CF conformant 'time' variable ;---http://www.ncl.ucar.edu/Document/Functions/WRF_contributed/wrf_times_c.shtml Time = wrf_times_c(Times, 1) ; CF time variable print(Time) print("-----") ;---Associate time values with variable as a coordinate variable ;---Required by calculate_daily_values x&Time = Time ; associate time values with variable print(x&Time) print("-----") printVarSummary(x) ; [Time | ??] x [south_north | ??] x [west_east | ??] print("-----") ymdh = cd_calendar(Time, -3) ; -3 ==> yyyy|month|day|hr ==> yyyymmddhh print(ymdh) print("-----") ;---Calculate daily means ;---http://www.ncl.ucar.edu/Document/Functions/Contributed/calculate_daily_values.shtml ;---Requires NCL 6.4.0 opt = True opt@_nval_crit = 4 ; require 4 values (no partial days) nDim = 0 ; Time' dimension 'id' xDayAvg = calculate_daily_values(x, "avg", nDim, opt) printVarSummary(xDayAvg) print("-----") ;---Print daily means at some arbitrarily specified grid point ymd = cd_calendar(xDayAvg&Time, -2) ; -2; ymd: yyyy|month|day (yyyymmdd) print(ymd) print("-----") print(ymd+" "+xDayAvg(:,40,45)) ; arbitrary grid location