thickness_hydrostatic#
- metpy.calc.thickness_hydrostatic(pressure, temperature, mixing_ratio=None, molecular_weight_ratio=0.6219569100577033, bottom=None, depth=None)[source]#
Calculate the thickness of a layer via the hypsometric equation.
This thickness calculation uses the pressure and temperature profiles (and optionally mixing ratio) via the hypsometric equation with virtual temperature adjustment.
\[Z_2 - Z_1 = -\frac{R_d}{g} \int_{p_1}^{p_2} T_v d\ln p,\]Which is based off of Equation 3.24 in [Hobbs2006].
This assumes a hydrostatic atmosphere. Layer bottom and depth specified in pressure.
- Parameters:
pressure (
pint.Quantity
) – Atmospheric pressure profiletemperature (
pint.Quantity
) – Atmospheric temperature profilemixing_ratio (
pint.Quantity
, optional) – Profile of dimensionless mass mixing ratio. If none is given, virtual temperature is simply set to be the given temperature.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\))bottom (
pint.Quantity
, optional) – The bottom of the layer in pressure. Defaults to the first observation.depth (
pint.Quantity
, optional) – The depth of the layer in hPa. Defaults to the full profile if bottom is not given, and 100 hPa if bottom is given.
- Returns:
pint.Quantity
– The thickness of the layer in meters
Examples
>>> import metpy.calc as mpcalc >>> from metpy.units import units >>> temperature = [278, 275, 270] * units.kelvin >>> pressure = [950, 925, 900] * units.millibar >>> mpcalc.thickness_hydrostatic(pressure, temperature) <Quantity(434.376889, 'meter')>
>>> bottom, depth = 950 * units.millibar, 25 * units.millibar >>> mpcalc.thickness_hydrostatic(pressure, temperature, bottom=bottom, depth=depth) <Quantity(215.835404, 'meter')>
To include the mixing ratio in the calculation:
>>> r = [0.005, 0.006, 0.002] * units.dimensionless >>> mpcalc.thickness_hydrostatic(pressure, temperature, mixing_ratio=r, ... bottom=bottom, depth=depth) <Quantity(216.552623, 'meter')>
Compute the 1000-500 hPa Thickness
>>> # pressure >>> p = [1008., 1000., 950., 900., 850., 800., 750., 700., 650., 600., ... 550., 500., 450., 400., 350., 300., 250., 200., ... 175., 150., 125., 100., 80., 70., 60., 50., ... 40., 30., 25., 20.] * units.hPa >>> # temperature >>> T = [29.3, 28.1, 23.5, 20.9, 18.4, 15.9, 13.1, 10.1, 6.7, 3.1, ... -0.5, -4.5, -9.0, -14.8, -21.5, -29.7, -40.0, -52.4, ... -59.2, -66.5, -74.1, -78.5, -76.0, -71.6, -66.7, -61.3, ... -56.3, -51.7, -50.7, -47.5] * units.degC >>> # specify a layer >>> layer = (p <= 1000 * units.hPa) & (p >= 500 * units.hPa) >>> # compute the hydrostatic thickness >>> mpcalc.thickness_hydrostatic(p[layer], T[layer]) <Quantity(5755.94719, 'meter')>
Notes
Only functions on 1D profiles (not higher-dimension vertical cross sections or grids). Since this function returns scalar values when given a profile, this will return Pint Quantities even when given xarray DataArray profiles.
Changed in version 1.0: Renamed
mixing
parameter tomixing_ratio
Examples using metpy.calc.thickness_hydrostatic
#
Advanced Sounding Plot with Complex Layout