tcpyPI: Tropical cyclone potential intensity calculations in Python
Project description
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:
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.
To install tcpypi from the command line:
pip install tcpypi
tcpyPI Dependencies
- NumPy
- Numba
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)
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
- test_pi_calc.ipynb - Simple code showing a single call of pi.py and testing the speed of the algorithm
- verify_pi.ipynb - Notebook validating/verifying pyPI outputs against BE02 MATLAB output data
- sample_output_analyses.ipynb - Notebook showing examples of pyPI outputs and simple PI analyses
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tcpypi-1.4.tar.gz.
File metadata
- Download URL: tcpypi-1.4.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3691daed05a7d0c01ff365850feba87d8d0287ccbf4848126b72a99e93b61cf9
|
|
| MD5 |
06ce3e39c423cfb2b5c471a7b8c5620b
|
|
| BLAKE2b-256 |
52e48f058e6834687e1b2fa6eeef6f3b3df02198a274c828fdbf14da26582601
|
Provenance
The following attestation bundles were made for tcpypi-1.4.tar.gz:
Publisher:
release.yaml on dgilford/tcpyPI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tcpypi-1.4.tar.gz -
Subject digest:
3691daed05a7d0c01ff365850feba87d8d0287ccbf4848126b72a99e93b61cf9 - Sigstore transparency entry: 173303191
- Sigstore integration time:
-
Permalink:
dgilford/tcpyPI@0772da9826d659e3a520144359a3c6a4d9ab5092 -
Branch / Tag:
refs/tags/v1.4 - Owner: https://github.com/dgilford
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@0772da9826d659e3a520144359a3c6a4d9ab5092 -
Trigger Event:
release
-
Statement type:
File details
Details for the file tcpypi-1.4-py3-none-any.whl.
File metadata
- Download URL: tcpypi-1.4-py3-none-any.whl
- Upload date:
- Size: 17.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8be34cb3f7ca6db1f98a94537ae1797dd85e94773d28cfdaecc6f97da91cad02
|
|
| MD5 |
449971fed5ef41e07e903df57074ff81
|
|
| BLAKE2b-256 |
aadff91b1d84521a7ef21ec4f58e69ac98ce131402d0d434dc841adb068aafe9
|
Provenance
The following attestation bundles were made for tcpypi-1.4-py3-none-any.whl:
Publisher:
release.yaml on dgilford/tcpyPI
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tcpypi-1.4-py3-none-any.whl -
Subject digest:
8be34cb3f7ca6db1f98a94537ae1797dd85e94773d28cfdaecc6f97da91cad02 - Sigstore transparency entry: 173303195
- Sigstore integration time:
-
Permalink:
dgilford/tcpyPI@0772da9826d659e3a520144359a3c6a4d9ab5092 -
Branch / Tag:
refs/tags/v1.4 - Owner: https://github.com/dgilford
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@0772da9826d659e3a520144359a3c6a4d9ab5092 -
Trigger Event:
release
-
Statement type: