Dear help,<br><br>I am having wrf forecast files saved in 1 hour interval. So I am having 72 files in total. like below<br>wrfout_d02_2010-06-10_00:00:00<br>wrfout_d02_2010-06-10_01:00:00<br>wrfout_d02_2010-06-10_02:00:00<br>
.....<br>etc.<br><br>I would like to calculate accumulated rainfall (RAINC + RAINNC) for every hourly i.e., for 1st hour, 2nd hour, 3rd hour etc. till 72th hour rainfall. I mean accumulated rainfall in every hour. So to calculate, 2nd hour rainfall, I need to substract previous hour(i.e., 1st hour). In the same way, to calculate 5th hour rainfall, I need to substract 4th hour rainfall. etc etc.<br>
<br>Following script, I wrote which is reading every wrfout files and plotting individually. I am not able to substract previous hour rainfall. Could you please help to solve it by modifying my script.<br><br>- - - - - -------- --- --- --- --- ---- <br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"<br><br>begin<br><br>datadir = "/casvol5/basantas/cas/WRF3-1/output-wrf/2010053000/"<br>
FILES = systemfunc ("ls -1 " + datadir + "wrfout_d02* " )<br>numFILES = dimsizes(FILES)<br><br>do ifil = 0,numFILES-1<br> a = addfile(FILES(ifil)+".nc","r")<br><br>; Set some basic resources<br>
res = True<br>; res@MainTitle = "REAL-TIME WRF"<br> res@InitTime = False<br> res@Footer = False<br><br> pltres = True<br> mpres = True<br>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>
<br>; What times and how many time steps are in the data set?<br> FirstTime = True<br> times = wrf_user_list_times(a) ; get times in the file<br> ntimes = dimsizes(times) ; number of times in the file<br>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>
do it = 0,ntimes-1,2 ; TIME LOOP<br><br> print("Working on time: " + times(it) )<br> if (FirstTime) then ; Save some times for tracking tendencies<br> times_sav = times(it)<br>
end if<br>; res@TimeLabel = times(it) ; Set Valid time to use on plots<br><br>day = systemfunc("echo "+times(it) +"|cut -c9-10")<br>yr = systemfunc("echo "+times(it) +"|cut -c1-4")<br>
mon = systemfunc("date '+%b'|tr [a-z] [A-Z]")<br>hr = systemfunc("echo "+times(it) +"|cut -c12-13")<br><br>; wks = gsn_open_wks(type,"rainhr")<br> wks = gsn_open_wks("ps","rainhr_"+day+mon+yr+"_"+hr+"Z")<br>
colors = (/"white","black" \ ; {for/back}ground<br> ,"white","azure" \<br> ,"green","palegreen","yellowgreen", "greenyellow" \<br>
,"yellow","goldenrod","orange","orangered" \<br> ,"red","deeppinK", "violet","darkviolet" \<br> ,"blueviolet","blue" /)<br>
gsn_define_colormap(wks, colors)<br><br>;gsn_define_colormap(wks,"gui_default")<br>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>; First get the variables we will need<br> <br> ; Get non-convective, convective and total precipitation<br>
rain_exp = wrf_user_getvar(a,"RAINNC",it)<br> rain_con = wrf_user_getvar(a,"RAINC",it)<br> rain_tot = rain_exp + rain_con<br>; rain_tot@description = "Precipitation Rate"<br> rain_tot@description = ""<br>
; rain_tot@units = "mm/hr"<br><br> opts = res<br> opts@cnFillOn = True<br> opts@mpOutlineBoundarySets = "AllBoundaries"<br> mpres@mpOutlineBoundarySets = "National"<br>
mpres@mpNationalLineThicknessF = 1.5<br> mpres@mpNationalLineColor = "Black"<br> mpres@mpGeophysicalLineColor = "Black"<br> mpres@mpGeophysicalLineThicknessF = 1.5<br><br>; set resource for color of contour <br>
;;; opts@cnLevelSelectionMode = "ManualLevels"<br>;;; opts@cnMinLevelValF = 0.<br>;;; opts@cnMaxLevelValF = 30.<br>;;; opts@cnLevelSpacingF = 2.<br>;;; opts@cnFillOn = True<br>
opts@cnLevelSelectionMode = "ExplicitLevels" ; explicit [unequal] cn levels<br> opts@cnLevels = (/0,0.1,1,2.5,5,7.5,10,15,20,25,37.5,50/)<br> ;;opts@cnLevels = (/0,0.1,1,2.5,5,7.5,10,15,20,25,37.5,50,75,100,125,150/)<br>
opts@cnFillOn = True<br> opts@cnFillMode = "AreaFill"<br>; opts@lbOrientation = "Vertical" ; default is horizontal<br><br> ; Total Precipitation (color fill)<br>
contour_tot = wrf_contour(a,wks,rain_tot,opts)<br><br> ; MAKE PLOTS<br> ; Total Precipitation <br> plot = wrf_map_overlays(a,wks,contour_tot,pltres,mpres)<br>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<br>
end do ; END OF TIME LOOP<br> end do ; END OF TIME LOOP<br>end<br>- - - - - -------- --- --- --- --- ---- <br><br>Thanking you,<br><br>with regards,'<br><br>Sahidull<br>