wrf_rh
Calculates relative humidity from ARW WRF model output.
Prototype
function wrf_rh ( Qv : numeric, P : numeric, T : numeric ) return_val [dimsizes(Qv)] : float or double
Arguments
QvAn array containing water vapor mixing ratio. The rightmost three dimensions must be [times x] level (bottom_top) x lat (south_north) x lon (west_east). Units are [kg kg-1].
PAn array of full pressure (perturbation + base state pressure) with the same dimension structure as Qv. Units are [Pa].
TAn array of temperature values with the same dimension structure as Qv. This variable should be calculated by wrf_tk. Units are [K].
Return value
A multi-dimensional array of the same size as Qv containing relative humidity [%]. The type will be double if any of the input is double, and float otherwise.
Description
This function returns relative humidity with respect to liquid water [%], which is estimated by the ratio of the actual to the saturation vapor pressure. This function also makes sure there are no negative values in Qv by setting them all to 0.
The return variable will contain two attributes:
return_val@description = "Relative Humidity"
return_val@units = "%"
See Also
Examples
Note: for WRF variable names and their definitions, you can easily check them by using "ncl_filedump":
ncl_filedump wrfout_d01_2000-01-24_12:00:00.nc
Example 1
Read and process a 4d array. This example uses the ">" operator to ensure that all Qv less than 0.0 are set to 0.0. The arguments are variables from WRF data.
Note that if your netCDF file doesn't have a ".nc" suffix, you must include it in the call to addfile so it knows what kind of file to open. The addfile call below will cause NCL to look for both a file called "wrfout_d01_2000-01-24_12:00:00.nc" and "wrfout_d01_2000-01-24_12:00:00".
a = addfile("wrfout_d01_2000-01-24_12:00:00.nc","r") Qv = a->QVAPOR P = a->P ; perturbation Pb = a->PB ; base state pressure P = P + Pb ; total pressure theta = a->T ; perturbation potential temperature (theta+t0) theta = theta + 300. TK = wrf_tk (P, theta) RH = wrf_rh (Qv, P, TK) printVarSummary(RH)Example 2
The function wrf_user_getvar, (available in the $NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl script) can also be used to calculate many diagnostics in one step.
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" a = addfile("wrfout_d01_2000-01-24_12:00:00.nc","r") time = 1 rh = wrf_user_getvar(a,"rh",time) ; calculate RH