
mixhum_ptd
Calculates the mixing ratio or specific humidity given pressure and dew point temperature.
Prototype
function mixhum_ptd ( p : numeric, tdk : numeric, iswit [1] : integer ) return_val [dimsizes(p)] : numeric
Arguments
pAn array of any dimensionality equal to pressure in Pa.
tdkAn array of any dimensionality equal to temperature dew point in K. Must be the same size as p.
iswitAn integer scalar that determines which variable is returned. 1 = mixing ratio (kg/kg), 2 = specific humidity (kg/kg). A negative value changes the units to g/kg.
Return value
An array of same size as p. The values will be the mixing ratio or the specific humidity depending upon the value of iswit.
Description
Calculates the mixing ratio or specific humidity given pressure and dew point temperature. Missing values are allowed but ignored.
There is a U.S. National Weather Service online Mixing Ratio Calculator available here.
See Also
Examples
Example 1
Wallace and Hobbs [Atmospheric Science: An introductory Survey, Academic Press (p74)] state that at p=100000 [Pa] and td=6.4 [C] the mixing ratio is approximately 6 [g/kg]:
p = 100000 ; Pa tdk= 6.4 + 273.15 ; K w = mixhum_ptd (p, tdk, 1) ; ==> 0.006061566 (kg/kg)Example 2
Assume p is in units of hPa. It must be converted to Pa before calling the function:
p = p*100. ; converts hPa to Pa w = mixhum_ptd (p, tdk, -1 ) ; ==> 6.06 (g/kg)