Metpy provides a function to calculate surface based CAPE (metpy.calc.surface_based_cape_cin) or starting pressure based CAPE (metpy.calc.cape_cin). See: https://unidata.github.io/MetPy/latest/api/generated/metpy.calc.html#module-metpy.calc
But is there a simple way or already existing specific module to calculate mixed layer CAPE (CAPE resulting from an ascending air parcel whose the start properties - pressure, temperature, dewpoint temperature - are those of a 100 hPa thickness mixed layer above the surface) ?
Thanks in advance for your help.
MetPy's cape_cin
function takes an arbitrary parcel profile, representing the temperature of a air parcel as it rises through the atmosphere. To get a profile that represents a parcel mixed over a depth, MetPy also has a mixed_parcel
function that "Determines the properties of an air parcel that is the result of complete mixing of a given atmospheric layer". This mixed parcel can then be passed to MetPy's parcel_profile
function to calculate the temperature as an arbitrary parcel rises:
import mepty.calc as mpcalc
_, t_parcel, td_parcel = mpcalc.mixed_parcel(p, T, Td, depth=100 * units.hPa)
profile = mpcalc.parcel_profile(p, t_parcel, td_parcel)
mpcalc.cape_cin(p, T, Td, profile)
By default mixed_parcel
will mix the parcel and return it to the first (assumed surface/starting) pressure value in p
.
MetPy should eventually gain the ability to have this work more readily out of the box, but this works today.