ecape

ecape is a simple module that contains an entraining CAPE, or ECAPE, calculation described by Peters et al. [PCS+23]. Peters [Pet23]-provided MatLab scripts serve as a reference and test verification data. The module leans heavily on MetPy [May et al. [MAM+23]] for meteorological calculations.

Package published via Hatch.

Installation & Use

To use ecape, install it with pip:

pip install ecape

See the examples page.

from ecape.calc import calc_ecape
...
ecape = calc_ecape(height, pressure, temperature, specific_humidity, u_wind, v_wind)

Source

https://github.com/citylikeamradio/ecape

Contact

Questions, comments, and feedback are certainly welcome. This project is a personal exercise in learning how to publish packages to Github & PyPI, so excuse the excessive documentation for one function 😄.

Future Work

  • add support for other water content variables

  • if useful, incorporate into MetPy

  • provide cli .nc, .csv, & aws support

A note on undiluted CAPE & calculation accuracy

If users prefer their own CAPE calculations, use the undiluted_cape parameter:

When comparing calc_ecape.py & COMPUTE_ECAPE.m run on Peters [Pet23] sample data, there is a ~10% difference in the resultant ECAPE. This is almost entirely due to a difference in calculated MUCAPE. The tests describe other sources of variation (~1%).

Given:
  • the methods here are within ~1% of Peters’ calculations when undiluted CAPE is equivalent

  • Peters et. al. specifically mention MetPy for determining undiluted CAPE

  • MetPy is a reliable, open-source, and frequently used meteorological calculation package

MetPy’s undiluted CAPE calculations were chosen for ease of readability and implementation.

References

[MAM+23]

Ryan M. May, Sean C. Arms, Patrick Marsh, Eric Bruning, John R. Leeman, Kevin Goebbert, Jonathan E. Thielen, Zachary S Bruick, and M. Drew. Camron. Metpy: a Python package for meteorological data. 2023. URL: Unidata/MetPy, doi:10.5065/D6WW7G29.

[PCS+23]

John M. Peters, Daniel R. Chavas, Chun-Yian Su, Hugh Morrison, and Brice E. Coffer. An analytic formula for entraining cape in mid-latitude storm environments. Journal of the Atmospheric Sciences, 2023. URL: https://journals.ametsoc.org/view/journals/atsc/aop/JAS-D-23-0003.1/JAS-D-23-0003.1.xml, doi:https://doi.org/10.1175/JAS-D-23-0003.1.