# cape_cin#

metpy.calc.cape_cin(pressure, temperature, dewpoint, parcel_profile, which_lfc='bottom', which_el='top')[source]#

Calculate CAPE and CIN.

Calculate the convective available potential energy (CAPE) and convective inhibition (CIN) of a given upper air profile and parcel path. CIN is integrated between the surface and LFC, CAPE is integrated between the LFC and EL (or top of sounding). Intersection points of the measured temperature profile and parcel profile are logarithmically interpolated.

Parameters:
• pressure (pint.Quantity) – Atmospheric pressure level(s) of interest, in order from highest to lowest pressure

• temperature (pint.Quantity) – Atmospheric temperature corresponding to pressure

• dewpoint (pint.Quantity) – Atmospheric dewpoint corresponding to pressure

• parcel_profile (pint.Quantity) – Temperature profile of the parcel

• which_lfc (str) – Choose which LFC to integrate from. Valid options are ‘top’, ‘bottom’, ‘wide’, and ‘most_cape’. Default is ‘bottom’.

• which_el (str) – Choose which EL to integrate to. Valid options are ‘top’, ‘bottom’, ‘wide’, and ‘most_cape’. Default is ‘top’.

Returns:

Examples

>>> from metpy.calc import cape_cin, dewpoint_from_relative_humidity, parcel_profile
>>> from metpy.units import units
>>> # 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
>>> # relative humidity
>>> rh = [.85, .65, .36, .39, .82, .72, .75, .86, .65, .22, .52,
...       .66, .64, .20, .05, .75, .76, .45, .25, .48, .76, .88,
...       .56, .88, .39, .67, .15, .04, .94, .35] * units.dimensionless
>>> # calculate dewpoint
>>> Td = dewpoint_from_relative_humidity(T, rh)
>>> # compture parcel temperature
>>> prof = parcel_profile(p, T[0], Td[0]).to('degC')
>>> # calculate surface based CAPE/CIN
>>> cape_cin(p, T, Td, prof)
(<Quantity(4703.77308, 'joule / kilogram')>, <Quantity(0, 'joule / kilogram')>)


Notes

$\text{CAPE} = -R_d \int_{LFC}^{EL} (T_{{v}_{parcel}} - T_{{v}_{env}}) d\text{ln}(p)$
$\text{CIN} = -R_d \int_{SFC}^{LFC} (T_{{v}_{parcel}} - T_{{v}_{env}}) d\text{ln}(p)$
• $$CAPE$$ is convective available potential energy

• $$CIN$$ is convective inhibition

• $$LFC$$ is pressure of the level of free convection

• $$EL$$ is pressure of the equilibrium level

• $$SFC$$ is the level of the surface or beginning of parcel path

• $$R_d$$ is the gas constant

• $$g$$ is gravitational acceleration

• $$T_{{v}_{parcel}}$$ is the parcel virtual temperature

• $$T_{{v}_{env}}$$ is environment virtual temperature

• $$p$$ is atmospheric pressure

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 dewpt parameter to dewpoint

## Examples using metpy.calc.cape_cin#

Sounding Calculation Examples

Sounding Calculation Examples