Skip to main content

tcpyPI: Potential Intensity Calculations in Python

tcpyPI, 'pyPI' for short, is a set of scripts and notebooks that compute and validate tropical cyclone (TC) potential intensity (PI) calculations in Python. It is a fully documented and improved port of the Bister and Emanuel 2002 algorithm (hereafter BE02) which was originally written in FORTRAN---and then MATLAB---by Prof. Kerry Emanuel (MIT). Kerry's original MATLAB code (pcmin.m) is found at:

The goals in developing and maintaining pyPI are to:

  • supply a freely available validated Python potential intensity calculator,
  • carefully document the BE02 algorithm and its Python implementation, and to
  • demonstrate and encourage the use of potential intensity theory in tropical cyclone climatology analysis.

If you have any questions, comments, or feedback, please contact the developer or open an Issue in the repository. A paper detailing pyPI is published at Geoscientific Model Development.

Citation

pyPI was developed by Daniel Gilford and has been archived on Zenodo:

DOI

If you use pyPI in your work, please include the citations:

Gilford, D. M.: pyPI (v1.3): Tropical Cyclone Potential Intensity Calculations in Python, Geosci. Model Dev., 14, 2351–2369, https://doi.org/10.5194/gmd-14-2351-2021, 2021.

and

Gilford, D. M. 2020: pyPI: Potential Intensity Calculations in Python, pyPI v1.3. Zenodo. http://doi.org/10.5281/zenodo.3985975

Full pyPI Description

Please read pyPI_Users_Guide_v1.3.pdf for a full overview and details on pyPI. The description includes the pyPI background, a PI computation derivation, validation against the commonly-used MATLAB algorithm (pcmin), and a set of sample analyses.

Getting Started

pyPI requires Python version 3.7+ to run. To get pyPI up and running on your system, clone the repository and ensure that you have the required dependencies.

Installation

pyPI is packaged using the python package manager pip.

PyPI version

To install tcpypi from the command line:

pip install tcpypi

tcpyPI Dependencies

Not required by tcpyPI---but highly recommended!---is the versatility in calculating PI over large datasets provided by xarray. Dependency versions were originally handled by Dependabot, but the code was not resilient to these changes so they are currently defunct (as of 10 August 2022). Please notify me immediately if installation problems persist.

Python Implementation of "pc_min" (BE02 PI Calculator)

pi.py is the Python function which directly computes PI given atmospheric and ocean state variables (akin to the BE02 algorithm MATLAB implementation pc_min.m). Given input vector columns of environmental atmospheric temperatures (T) and mixing ratios (R) on a pressure grid (P), sea surface temperatures (SST), and mean sea-level pressures (MSL), the algorithm outputs potential intensity, the outflow level, the outflow temperature, and the minimum central pressure, and a flag that shows the status of the completed PI calculation. pyPI is an improvement on pcmin in that it handles missing values depending on user input flags.

Users who want to apply the PI calculation to a set of local environmental conditions need only to download pi.py, organize their data appropriately, and call the function to return outputs, e.g.:

(VMAX,PMIN,IFL,TO,LNB)=pi(SST,MSL,P,T,R)

Sensitivity & Configuration Options

tcpyPI.pi() exposes a few key “sensitivity knobs” that can materially change results. The most commonly explored options are:

  • CKCD (default 0.9): exchange coefficient ratio (Ck/Cd).
  • diss_flag (default 1): include (1) or exclude (0) dissipative heating.
  • ascent_flag (default 0): reversible (0) vs pseudo-adiabatic (1) ascent assumption.
  • V_reduc (default 0.8): reduction from gradient wind to 10 m wind speed.
  • ptop (default 50 hPa): top pressure bound; setting too high can bias outflow level/temperature.
  • miss_handle (default 1): missing-profile handling; 1 returns missing on any NaNs.
  • outflow_source (default "cape_star"): how outflow level/temperature are defined:
    • "cape_star": outflow is the LNB (OTL) and temperature (T0) from the saturated CAPE* calculation (default; BE02/pcmin behavior).
    • "cape_env": outflow is the LNB and temperature from the environmental CAPE (CAPEenv) on the final convergence iteration (see Gilford et al. 2021 discussion). Where the environmental parcel has no level of neutral buoyancy, outputs are missing with IFL=4 (v1.5+; shallow, lower-tropospheric outflows are common in the subtropics).

Example:

from tcpyPI import pi

vmax, pmin, ifl, t0, otl = pi(SSTC, MSL, P, TC, R, CKCD=0.9, diss_flag=1, outflow_source="cape_env")

Log Decomposition (Wing et al. 2015)

tcpyPI provides a simple API for log-decomposing PI into efficiency, disequilibrium, and Ck/Cd terms (where lnpi = ln(V^2)):

from tcpyPI import log_decompose_pi, pi_log_decomposition

out = pi_log_decomposition(SSTC, MSL, P, TC, R, CKCD=0.9)  # SSTC/TC in Celsius
lnpi, lneff, lndiseq, lnCKCD = log_decompose_pi(out["vmax"], SSTC, out["t0"], CKCD=0.9, sst_units="C")

Running a pyPI Sample

Included in the pyPI release is a sample script run_sample.py which runs global sample data from MERRA2 (in 2004) through pi.py, vectorizes the output, and performs several simple analyses. To run, simply:

python run_sample.py

and examine the outputs locally produced in full_sample_output.nc.

File Descriptions

Key files

  • pi.py - The primary function of pyPI, that computes and outputs PI (and associated variables) given atmospheric and ocean state variables.
  • run_sample.py - Example script that computes PI and accompanying analyses over the entire sample dataset

Data

  • sample_data.nc - Sample atmospheric and ocean state variable data and BE02 MATLAB output data; values are monthly averages over the globe from MERRA2 in 2004.
  • mdr.json - Main Development Region definitions from Gilford et al. (2017)
  • raw_sample_output.nc - Sample outputs from pi.py only created by run_sample.py
  • full_sample_output.nc - Full set of sample outputs from pi.py as well as sample analyses such as PI decomposition

Validation and Testing Notebooks

Misc.

  • utilities.py - Set of functions used in the pyPI codebase
  • constants.py - Set of meteorological constants used in the pyPI codebase
  • reference_calculations.m - Script used to generate sample BE02 MATLAB output data from original MERRA2 files monthly mean; included for posterity and transparency
  • pc_min.m - Original BE02 algorithm from MATLAB, adapted and used to produce analyses of Gilford et al. (2017; 2019)
  • clock_pypi.ipynb - Notebook estimating the time it takes to run pyPI on a laptop

Author

  • Daniel M. Gilford, PhD - Creation, Development, & Maintenance - GitHub

Contributor(s)

  • Ben Mares - Modernization - GitHub
  • Daniel Rothenberg, PhD - Numba Optimization & Sample Code - GitHub

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

  • Kerry Emanuel (MIT) - Development of potential intensity theory; encouragement and permission to pursue Python implementation
  • Susan Solomon (MIT), Paul O'Gorman (MIT), Allison Wing (FSU) - Helpful conversations, advice, and suggestions on TC PI research
  • Dan Chavas (Purdue), Jonathan Lin (MIT), Raphael Rousseau-Rizzi (MIT) - Feedback on pyPI code and documentation

Metadata

Release files for tcpyPI 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tcpyPI 1.5.0
File Size Uploaded Provenance Actions
tcpypi-1.5.0.tar.gz 95.9 MB With provenance Details for tcpypi-1.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tcpyPI 1.5.0
File Interpreter ABI Platform Actions
tcpypi-1.5.0-py3-none-any.whl Python 3 none any Details for tcpypi-1.5.0-py3-none-any.whl

Total release size: 96.0 MB

Release files / tcpypi-1.5.0.tar.gz

Download URL tcpypi-1.5.0.tar.gz
Size 95.9 MB
Tags Source
SHA-256 checksum
How to use checksums
a70a6524977e34ef4b157e866296df6d6b49b9122e9b82ed46c7e02f16d43347
BLAKE2b-256 checksum
How to use checksums
72928fe3cdd5442ac19e682e946cc379dff6eb4a02e621501212fb6560add97a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / tcpypi-1.5.0-py3-none-any.whl

Download URL tcpypi-1.5.0-py3-none-any.whl
Size 22.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e8707fe3b2d38aadaa254e823fb46251067b855209f92ffa85690f714fe75c0
BLAKE2b-256 checksum
How to use checksums
7294deb455dd1acd8739b73931aead3b6c97bba6da1e72c985fa0c091a3f17a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for tcpyPI 1.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tcpypi-1.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page