mixing_ratio_from_specific_humidity#
- metpy.calc.mixing_ratio_from_specific_humidity(specific_humidity)#
Calculate the mixing ratio from specific humidity.
- Parameters
specific_humidity (
pint.Quantity
) – Specific humidity of air- Returns
pint.Quantity
– Mixing ratio
Examples
>>> from metpy.calc import mixing_ratio_from_specific_humidity >>> from metpy.units import units >>> sh = [4.77, 12.14, 6.16, 15.29, 12.25] * units('g/kg') >>> mixing_ratio_from_specific_humidity(sh).to('g/kg') <Quantity([ 4.79286195 12.28919078 6.19818079 15.52741416 12.40192356], 'gram / kilogram')>
Notes
Formula from [Salby1996] pg. 118.
\[w = \frac{q}{1-q}\]\(w\) is mixing ratio
\(q\) is the specific humidity