[ncl-talk] Plot for 24 hour average

Komal Shukla komalshukla1992 at gmail.com
Tue Nov 27 13:06:45 MST 2018


Hi,

Can someone please look into this? It might be very simple.

 I use the below mentioned script in ncl to generate a monthly average plot
for a variable from wrfout files(wrfchem). It works really well. I get =  1
file/30 days (monthly average)
Each of my wrfoutfile is written for 24 hours in it ( 0 to 23 hours), and I
have 30 such files for a month.

Case 1 : I need to get the monthly average of only 16 to 21 hours. My
script is giving monthly average of 0 to 23 hours.

Case2 : I am trying to form 24 plots from these 30 files. Hourly average
plots. Each plot representing an hours average over the month(30 files). I
want = 24 files/30 days (hourly average)



My script is written here, I am unable to write the script change/loop for
the above case, can someone please change the script for both the cases to
help me get the mentioned plots?



begin
 a = addfile("../wrfout_d02_2016-11-01_00:00:00.nc","r")
 it        = 0     ; first time step
  hgt       = wrf_user_getvar(a,"HGT_M",it)    ; Terrain elevation
  hgt at lat2d = wrf_user_getvar(a,"XLAT",it)   ; latitude/longitude
  hgt at lon2d = wrf_user_getvar(a,"XLONG",it)  ; required for plotting
  wks = gsn_open_wks("png","OR1")
    FILES = systemfunc ("ls ../wrfout_d02_2016-11-01*") ; file paths
numFILES = dimsizes(FILES)
 aa    = addfiles (FILES+".nc", "r")     ;add multiple files
 OR1= wrf_user_getvar(aa,"OR1",-1)      ; 3D tc
  OR1_avg=dim_avg_n(OR1,0)
 OR1_avg2D=OR1_avg(0,:,:)
  OR1_avg2D at lat2d = wrf_user_getvar(a,"XLAT",it)   ; latitude/longitude
  OR1_avg2D at lon2d = wrf_user_getvar(a,"XLONG",it)  ; required for plotting
--removing additional plot design options--
contour = gsn_csm_contour_map(wks,OR1_avg2D,res)
draw(contour)
  frame(wks)

Thanks

Komal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181128/1cc7566a/attachment.html>


More information about the ncl-talk mailing list