'reinit'
*
*   Calculate the WRF precipitation rates from the accumulated rainfall...
*
*     Set up the "wrf_dt" for the forward time difference; the analysis
*     points are 5 min apart => dt = 5*60 = 300 seconds
*
*     Also, convert WRF precipitation rate from units of [mm/s] to [mm/day]
*
wrf_ctl   = '/archive/cjs/OUTPUT/GFDL_WRF/KWAJEX/3D/dz_250m/RAINNC.06:05z24Jul1999_2.ctl'
wrf_var   = 'RAINNC'
wrf_dt    = 5*60
wrf_scale = 86400
units     = '(mm d`a-1`n)'
say
say '------------------------------------------------'
say 'Calculating WRF precipitation rates'
say '------------------------------------------------'
say
say 'Open GrADS ctl file:'
say '...'wrf_ctl
'open 'wrf_ctl
say 'GrADS ctl file ready.'
say
'query file'
say result
say
rec5 = sublin(result,5)
xsiz = subwrd(rec5,3) ; ysiz = subwrd(rec5,6) ; zsiz = subwrd(rec5,9) ; tsiz = subwrd(rec5,12)
say ' xsiz 'xsiz
say ' ysiz 'ysiz
say ' zsiz 'zsiz
say ' tsiz 'tsiz
say
say
say 'Calculate the WRF precipitation rates from accumulated precip...'
say 'convert WRF model accumulated precipitation from [mm] to [mm/day]'
*
*  Determine time range covering the entire time series for the WRF model...
*  note, we can only go to "tsiz-1" because we do forward-in-time finite
*  differences for the WRF model precipitation rate...
*
'set x 1 'xsiz
'set y 1 'ysiz
'set z 1'
'set t 1 'tsiz-1
'query time'
rec = sublin(result,1)
tmin = subwrd(rec,3) ; tmax = subwrd(rec,5)
say
say 'WRF Model time series is from "'tmin'" to "'tmax'"... '
say ' (or from time level "1" to "'tsiz-1'")'
say
*
*  WRF Precipitation Rate in [mm/s]
*
'define prate = (RAINNC(t+1)-RAINNC(t+0))/'wrf_dt
*
*  WRF Precipitation Rate in [mm/day]
*
'define wrfp = 'wrf_scale'*'prate
*
say '...WRF Model precipitation rates defined'
*
'set t 'tsiz-1
'query time' ; tplot = subwrd(rec,3)
'set gxout shaded'
'set xlint 0.1'
'set ylint 0.1'
'd wrfp'
'draw title \\\ WRF Precipitation Rate 'units' \ 'tplot
say
say '...WRF Model precipitation rates plotted at 'tplot
say
