diagnostics
Python script to compute diagnostics (new variables) from model outputs

Diagnostics are computed as a given pre-defined combination of variables [var1n], ..., [varNn] as:
  -v [VarName]|[var1n]@....@[varNn]
A large series of diagnostics are prepared to be computed from WRF model output. When a given diagnostic has to be computed from the WRF output, the label of the medthod starts with 'WRF', becoming the name of the method:
  `WRF[variable]'
It is required to indicate dimensions and variable-dimensions (variables which content the values for a given dimension) from the file. Again, because WRF model provides a not so-useful time variable, one can provide `WRFtime' for the 'Time' dimension and automatically, the resultant file will content a CF-time variable directly computed from WRF variables 'Times'
Finally, in order to faciliate the use of the script for WRF users, some diagnostics require standard variables like pressure, geopotential, air temperature, ... These variables are not directly obtained from WRF output. In order to overcome this problem, python script is already prepared with the computation of these variables, when they are provided as required variables for the diagnostics (one of the [varin]). These pre-prepared variables are:
NameDescriptionComputation ([WRFvar])units
WRFgeopGeopotential height [PH]+[PHB]gpm
WRFpPressure[P]+[PB]Pa
WRFtair temperature([T]+300.)*(WRFp/100000.)**(2./7.)
WRFrhrelative humidtydata1=10.*0.6112*np.exp(17.67*(WRFt-273.16)/(WRFt-29.65))
data2 = 0.622*data1/(0.01*WRFp-(1.-0.622)*data1) WRFrh = [QVAPOR]/data2
1
WRFghtGeopotential height [PH]+[PHB]gpm
WRFdensair density[DNW]*([MU]+[MUB])/gkgm-3
WRFpospositions from the lowest-leftest corner of the matrixsqrt(([DY]*iy)**2+([DX]*ix)**2)/[MAPFAC_M]m
WRFtimeCF-time compilant[Times]minutes since 1949-12-01 00:00:00
WRFzheight above surfaceWRFgeop/g-[HGT]m

A new file called `diagnostics.nc' will be created with the required diagnostics and the correspondant dimensions

diagnostics.py -f [file] -d [dimns] -v [varns]
  [file]= netCDF output file
  [dimns]=[dimtn]@[dtvn],[dimzn]@[dzvn],[...,[dimxn]@[dxvn]] ',' list with the couples [dimDn]@[dDvn], [dimDn], name of the dimension D and name of the variable [dDvn] with the values of the dimension. It must be provided in the same order as in the file
  [varns]=[varn1]|[var11]@[...[varN1]],[...,[varnM]|[var1M]@[...[varLM]]] ',' list of variables to compute [varnK] and its necessary ones [var1K]...[varPK] (separated by '|')

Available diagnostics (content of `diagnostics.inf'):
sea level altitude from WRFrelative altitude from surface from WRF
CF NameName in scriptvariablesdescription
1This diagnostics also computes:
cinConvective inhibition
lfcppressure of level of free convection
lfczheight of level of free convection
lilifted index
bils WRFbils HFX@LHtotal heat surface flux from WRF
cape WRFcape_afwaWRFt@WRFrh@WRFp@WRFgeop@HGTConvective Available Potential Energy (cape)1
clt clt CLDFRAtotal cloud cover from WRF
cll cllmh CLDFRA@WRFplow-level (p > 660 hPa) cloudiness from WRF
clm cllmh CLDFRA@WRFpmid-level (660 < p > 440 hPa) cloudiness from WRF
clh cllmh CLDFRA@WRFphigh-level (p < 440 hPa) cloudiness from WRF
clivi WRFclivi WRFdens@QICE@QHAIL@QGRAUPELIce water path
clwvi WRFclwvi WRFdens@QCLOUD@QICE@QHAIL@QGRAUPELCloud condensed water path
hur LMDZrh pres@t@rrelative humidity from LMDZ/DYNAMICO
hur WRFrh WRFrh@T@P@PBrelative humidity from WRF
hurs LMDZrhs psol@t2m@q2m2 m relative humidity from LMDZ/DYNAMICO
hurs TSrhs psfc@t@q2 m relative humidity from WRF's time-series files
hurs WRFrhs PSFC@T2@Q22 m relative humidity from WRF
mrso WRFmrso SMOIS@DZStotal soil moisture content
p WRFp P@PBair pressure
evspsblpot WRFpotevap_orPM WRFdens@UST@U10@V10@T2@PSFC@QVAPORPotent5ial evapotranspiration following Penman-Monteith formulation implemented in ORCHIDEE
p WRFp P@PBair pressure from WRF
pr RAINTOT RAINC@RAINNC@WRFtimeprecipitation flux from WRF
pracc ACRAINTOT RAINC@RAINNC@WRFtimeaccumulated precipitation from WRF
prc WRFprc deaccum@RAINC@XTIME@prcconvective precipitation flux from WRF
prls WRFprls deaccum@RAINNC@XTIME@prlslarge-scale precipitation flux from WRF
prw WRFprw WRFdens@QVAPORliquid water path from WRF
psl WRFmslp WRFp@PSFC@HGT@WRFt@QVAPORMean sea level pressure from WRF (following NCAR, C. Bruyé's 'pinterp')
psl WRFpsl_ecmwf PSFC@HGT@WRFt@WRFp@ZNU@ZNW sea level pressure using ECMWF method
psl WRFpsl_ptarget WRFp@PSFC@WRFt@HGT@QVAPORSame as WRFmslp, but Fortran based
rvor rvor U@Vaire relative vorticity from WRF
rvors WRFrvors U10@V10@WRFpos10 m aire relative vorticity from WRF
slw WRFslw SH2O@DZSTotal soil water content
ta WRFt T@P@PBair temperature from WRF
td WRFtd WRFp@WRFt2@QVAPORair dew-point temperature from WRF
tds TStd psfc@t@q2m air dew-point temperature from WRF's time-series files
tds WRFtds PSFC@T2@Q22m air dew-point temperature from WRF
ua WRFua U@V@SINALPHA@COSALPHAeastward wind speed of air from WRF
va WRFva U@V@SINALPHA@COSALPHAnorthward wind speed of air from WRF
uavaz WRFzwind U@V@WRFz@U10@V10@SINALPHA@COSALPHA@z=100.Height wind extrapolation using power-law method (e.g. at 100. m)
uavaz WRFzwind_log U@V@WRFz@U10@V10@SINALPHA@COSALPHA@z=100.Height wind extrapolation using logarithmic method (e.g. at 100. m)
uavaz WRFzwindMO UST@ZNT@RMOL@U10@V10@SINALPHA@COSALPHA@z=100.Height wind extrapolation using Monin-Obukhov theory (e.g. at 100. m)
wa OMEGAw vitw@pres@tempvertical wind speed from LMDZ
wds TSwds u@vwind speed direction from WRF's time-series files
wds wds U10@V1010 m wind speed direction from WRF
ws ws U@Vair wind speed from WRF
wss wss U10@V1010m wind speed from WRF
wss wss u10m@v10m10m wind speed from LMDZ/DYNAMICO
wssturbturbulencewssWind speed turbulence (Taylor's wss*= < wss > - wss)
zgWRFghtPH@PHBGeopotential height from WRF
zhgtWRFheightPH@PHB@WRFgeop
zhgtrelWRFheightrelPH@PHB@HGT
wssturbturbulencewssWind speed turbulence
zg WRFght PH@PHBGeopotential height
zmla WRFzmlagen T@QVAPOR@WRFgeop@HGTPBL height following a generic method
Special diagnostics (variables which depend on the selection):
python diagnostics.py -f wrfout_d01_2001-11-11_00:00:00 -d 'Time@WRFtime,bottom_top@ZNU,south_north@XLAT,west_east@XLONG' -v 'clt|CLDFRA,cllmh|CLDFRA@WRFp'
CF NameName in scriptvariablesdescription
[varn]WRF_denszintWRFdens@varn=clivi@QCLOUD@QICE@QGRAUPEL Vertical mass integration (vertical density dependence) of a series of variables from WRF with name [varn]