density

metpy.calc.density(pressure, temperature, mixing_ratio, molecular_weight_ratio=<Quantity(0.62195691, 'dimensionless')>)[source]

Calculate density.

This calculation must be given an air parcel’s pressure, temperature, and mixing ratio. The implementation uses the formula outlined in [Hobbs2006] pg.67.

Parameters
  • pressure (pint.Quantity) – Total atmospheric pressure

  • temperature (pint.Quantity) – Air temperature

  • mixing_ratio (pint.Quantity) – Mass mixing ratio (dimensionless)

  • molecular_weight_ratio (pint.Quantity or float, optional) – The ratio of the molecular weight of the constituent gas to that assumed for air. Defaults to the ratio for water vapor to dry air. (\(\epsilon\approx0.622\))

Returns

pint.Quantity – Corresponding density of the parcel

Notes

\[\rho = \frac{p}{R_dT_v}\]

Changed in version 1.0: Renamed mixing parameter to mixing_ratio