mixing_ratio_from_relative_humidity#
- metpy.calc.mixing_ratio_from_relative_humidity(pressure, temperature, relative_humidity, *, phase='liquid')[source]#
Calculate the mixing ratio from relative humidity, temperature, and pressure.
- Parameters:
pressure (
pint.Quantity
) – Total atmospheric pressuretemperature (
pint.Quantity
) – Air temperaturerelative_humidity (array-like) – The relative humidity expressed as a unitless ratio in the range [0, 1]. Can also pass a percentage if proper units are attached.
phase ({'liquid', 'solid', 'auto'}) – Where applicable, adjust assumptions and constants to make calculation valid in
'liquid'
water (default) or'solid'
ice regimes.'auto'
will change regime based on determination of phase boundaries, eg temperature relative to freezing.
- Returns:
pint.Quantity
– Mixing ratio (dimensionless)
Examples
>>> from metpy.calc import mixing_ratio_from_relative_humidity >>> from metpy.units import units >>> p = 1000. * units.hPa >>> T = 28.1 * units.degC >>> rh = .65 >>> mixing_ratio_from_relative_humidity(p, T, rh).to('g/kg') <Quantity(15.7296568, 'gram / kilogram')>
Notes
Employs [WMO8] eq. 4.A.16 as derived from WMO relative humidity definition based on vapor partial pressures (eq. 4.A.15).
\[RH = \frac{w}{\epsilon + w} \frac{\epsilon + w_s}{w_s}\]\[\therefore w = \frac{\epsilon * w_s * RH}{\epsilon + w_s (1 - RH)}\]\(w\) is mixing ratio
\(w_s\) is the saturation mixing ratio
\(\epsilon\) is the molecular weight ratio of vapor to dry air
\(RH\) is relative humidity as a unitless ratio
Changed in version 1.0: Changed signature from
(relative_humidity, temperature, pressure)