specific_humidity_from_mixing_ratio#
- metpy.calc.specific_humidity_from_mixing_ratio(mixing_ratio)#
Calculate the specific humidity from the mixing ratio.
- Parameters:
mixing_ratio (
pint.Quantity
) – Mixing ratio- Returns:
pint.Quantity
– Specific humidity
Examples
>>> from metpy.calc import specific_humidity_from_mixing_ratio >>> from metpy.units import units >>> specific_humidity_from_mixing_ratio(19 * units('g/kg')) <Quantity(18.6457311, 'gram / kilogram')>
Notes
Formula from [Salby1996] pg. 118.
\[q = \frac{w}{1+w}\]\(w\) is mixing ratio
\(q\) is the specific humidity