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 &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl&quot;<br><br>begin<br><br>datadir = &quot;/casvol5/basantas/cas/WRF3-1/output-wrf/2010053000/&quot;<br>
FILES = systemfunc (&quot;ls -1 &quot; + datadir + &quot;wrfout_d02* &quot; )<br>numFILES = dimsizes(FILES)<br><br>do ifil = 0,numFILES-1<br>   a = addfile(FILES(ifil)+&quot;.nc&quot;,&quot;r&quot;)<br><br>; Set some basic resources<br>
  res = True<br>;  res@MainTitle = &quot;REAL-TIME WRF&quot;<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(&quot;Working on time: &quot; + 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(&quot;echo &quot;+times(it) +&quot;|cut -c9-10&quot;)<br>yr =  systemfunc(&quot;echo &quot;+times(it) +&quot;|cut -c1-4&quot;)<br>
mon = systemfunc(&quot;date &#39;+%b&#39;|tr [a-z] [A-Z]&quot;)<br>hr = systemfunc(&quot;echo &quot;+times(it) +&quot;|cut -c12-13&quot;)<br><br>; wks = gsn_open_wks(type,&quot;rainhr&quot;)<br> wks = gsn_open_wks(&quot;ps&quot;,&quot;rainhr_&quot;+day+mon+yr+&quot;_&quot;+hr+&quot;Z&quot;)<br>
  colors = (/&quot;white&quot;,&quot;black&quot;          \        ; {for/back}ground<br>            ,&quot;white&quot;,&quot;azure&quot;          \<br>            ,&quot;green&quot;,&quot;palegreen&quot;,&quot;yellowgreen&quot;, &quot;greenyellow&quot; \<br>
            ,&quot;yellow&quot;,&quot;goldenrod&quot;,&quot;orange&quot;,&quot;orangered&quot;        \<br>            ,&quot;red&quot;,&quot;deeppinK&quot;, &quot;violet&quot;,&quot;darkviolet&quot;          \<br>            ,&quot;blueviolet&quot;,&quot;blue&quot;                              /)<br>
 gsn_define_colormap(wks, colors)<br><br>;gsn_define_colormap(wks,&quot;gui_default&quot;)<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,&quot;RAINNC&quot;,it)<br>    rain_con = wrf_user_getvar(a,&quot;RAINC&quot;,it)<br>    rain_tot = rain_exp + rain_con<br>;    rain_tot@description = &quot;Precipitation Rate&quot;<br>    rain_tot@description = &quot;&quot;<br>
;    rain_tot@units = &quot;mm/hr&quot;<br><br>        opts = res<br>        opts@cnFillOn = True<br>        opts@mpOutlineBoundarySets  = &quot;AllBoundaries&quot;<br>        mpres@mpOutlineBoundarySets  = &quot;National&quot;<br>
        mpres@mpNationalLineThicknessF = 1.5<br>        mpres@mpNationalLineColor = &quot;Black&quot;<br>        mpres@mpGeophysicalLineColor = &quot;Black&quot;<br>        mpres@mpGeophysicalLineThicknessF = 1.5<br><br>; set resource for color of contour <br>
;;;       opts@cnLevelSelectionMode = &quot;ManualLevels&quot;<br>;;;       opts@cnMinLevelValF       = 0.<br>;;;       opts@cnMaxLevelValF       = 30.<br>;;;       opts@cnLevelSpacingF      = 2.<br>;;;       opts@cnFillOn             = True<br>
  opts@cnLevelSelectionMode  = &quot;ExplicitLevels&quot; ; 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            = &quot;AreaFill&quot;<br>;  opts@lbOrientation         = &quot;Vertical&quot;       ; 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,&#39;<br><br>Sahidull<br>