A Parallel Object-Oriented Cyclone Tracker in Python
Project description
PyStormTracker
PyStormTracker provides the implementation of the "Simple Tracker" algorithm used for cyclone trajectory analysis in Yau and Chang (2020). It was originally developed at the National Center for Atmospheric Research (NCAR) as part of the 2015 Summer Internships in Parallel Computational Science (SIParCS) program, utilizing a task-parallel strategy with temporal decomposition and a tree reduction algorithm to process large climate datasets.
Features
- Modern Python Support: Strictly targets Python 3.11+ with comprehensive type hints and 100% strict
mypycompliance. - Xarray Integrated: Leverages
xarraywith optimized I/O, acceleration, and parallel extras for robust, high-performance coordinate-aware processing and lazy data loading. - Parallel Backends:
- Dask (Default): Automatically scales to all available CPU cores on local machines.
- MPI: Supports distributed execution via
mpi4py. - Serial: Standard sequential execution for smaller datasets or debugging.
- Robust Detection: Optimized $O(N)$ extrema filtering and robust handling of masked/missing data.
- CI/CD Integrated: Automated linting, type-checking, and code coverage reporting via GitHub Actions.
- Standardized Output: Results are exported to the IMILAST intercomparison format (.txt) with readable datetime strings and formatted numeric values.
Technical Methodology
PyStormTracker treats meteorological fields as 2D images and leverages scipy.ndimage for robust feature detection:
- Local Extrema Detection: Uses an optimized sliding window filter to identify local minima (cyclones) or maxima (anticyclones/vorticity).
- Intensity & Refinement: Applies the Laplacian operator (
laplace) to measure the "sharpness" of the field at each detected center point. This is used to resolve duplicates and ensure only the most physically intense point is kept when multiple adjacent pixels are flagged. - Spherical Continuity: Utilizes
mode='wrap'for all filters to correctly handle periodic boundaries across the Prime Meridian, enabling seamless tracking across the entire globe. - Heuristic Linking: Implements a nearest-neighbor linking strategy to connect detected centers into trajectories across successive time steps.
Documentation
Full documentation, including API references and advanced usage examples, is available at pystormtracker.readthedocs.io.
Installation
Prerequisites
- Python 3.11+
- (Optional) OpenMPI for MPI support.
From PyPI (Recommended)
You can install the latest stable version of PyStormTracker directly from PyPI:
pip install PyStormTracker
From Source
-
Clone the repository:
git clone https://github.com/mwyau/PyStormTracker.git cd PyStormTracker
-
Install with uv (Recommended):
uv sync --extra dev uv run pre-commit install --hook-type pre-push
Usage
Once installed, you can use the stormtracker command directly:
stormtracker -i era5_msl_2.5x2.5.nc -v msl -o my_tracks
Command Line Arguments
| Argument | Short | Description |
|---|---|---|
--input |
-i |
Required. Path to the input NetCDF file. |
--var |
-v |
Required. Variable name to track (e.g., msl, vo). |
--output |
-o |
Required. Path to the output track file (appends .txt if missing). |
--num |
-n |
Number of time steps to process. |
--mode |
-m |
min (default) for low pressure, max for vorticity/high pressure. |
--backend |
-b |
dask (default), serial, or mpi. |
--workers |
-w |
Number of Dask workers (defaults to CPU core count). |
Development
Setup
Using uv is the recommended way to set up your environment:
# Install dependencies and sync virtual environment
uv sync --extra dev
# Install pre-push hooks
uv run pre-commit install --hook-type pre-push
Quality Control
Run automated checks using uv run:
Linting & Formatting:
uv run ruff check . --fix
uv run ruff format .
Type Checking:
uv run mypy src/
Tiered Testing
To keep development cycles fast, testing is tiered:
- Fast Tests: Default local runs (skips slow tests).
- Slow Tests: ONLY long-running integration/regression tests.
- Full Suite: Everything (used in CI).
Run fast unit tests only (Default):
uv run pytest
Run ONLY slow/integration tests:
uv run pytest --run-slow
Run everything:
uv run pytest --run-all
Citations
If you use this software in your research, please cite the following:
-
Yau, A. M. W., and E. K. M. Chang, 2020: Finding Storm Track Activity Metrics That Are Highly Correlated with Weather Impacts. Part I: Frameworks for Evaluation and Accumulated Track Activity. J. Climate, 33, 10169–10186, https://doi.org/10.1175/JCLI-D-20-0393.1.
-
Yau, A. M. W., 2026: mwyau/PyStormTracker. Zenodo, https://doi.org/10.5281/zenodo.18764813.
References
- Yau, A. M. W., K. Paul and J. Dennis, 2016: PyStormTracker: A Parallel Object-Oriented Cyclone Tracker in Python. 96th American Meteorological Society Annual Meeting, New Orleans, LA. Zenodo, https://doi.org/10.5281/zenodo.18868625.
- Neu, U., et al., 2013: IMILAST: A Community Effort to Intercompare Extratropical Cyclone Detection and Tracking Algorithms. Bull. Amer. Meteor. Soc., 94, 529–547, https://doi.org/10.1175/BAMS-D-11-00154.1.
- IMILAST Intercomparison Protocol: https://proclim.scnat.ch/en/activities/project_imilast/intercomparison
- IMILAST Data Download: https://proclim.scnat.ch/en/activities/project_imilast/data_download
License
This project is licensed under the terms found in the LICENSE file.
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 pystormtracker-0.3.0.tar.gz.
File metadata
- Download URL: pystormtracker-0.3.0.tar.gz
- Upload date:
- Size: 564.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90a94a2d59f9ed5e9bd6f9e5200a2fd1bc6a2dd6d70d0d412e079621a4b0c568
|
|
| MD5 |
4ae9b51bc724ca51c19ae9786b863c2a
|
|
| BLAKE2b-256 |
1828e7f98e2d35f8e1412e9d98ff273a010494f367d164c46b198cf288284648
|
Provenance
The following attestation bundles were made for pystormtracker-0.3.0.tar.gz:
Publisher:
python-publish.yml on mwyau/PyStormTracker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pystormtracker-0.3.0.tar.gz -
Subject digest:
90a94a2d59f9ed5e9bd6f9e5200a2fd1bc6a2dd6d70d0d412e079621a4b0c568 - Sigstore transparency entry: 1059846526
- Sigstore integration time:
-
Permalink:
mwyau/PyStormTracker@03ce86e497b92c3957962edf405a04760ed90261 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/mwyau
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@03ce86e497b92c3957962edf405a04760ed90261 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pystormtracker-0.3.0-py3-none-any.whl.
File metadata
- Download URL: pystormtracker-0.3.0-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e430e191ab30da6e3ea14f0a38172a18028e2e4726034b90b9f6042ce7081560
|
|
| MD5 |
46ee3cd7af76c6f3238eafbfc8c4062b
|
|
| BLAKE2b-256 |
01291be3bd3f879a4f4798be48040202bc8850edc1c1fd62890158110ad14ddb
|
Provenance
The following attestation bundles were made for pystormtracker-0.3.0-py3-none-any.whl:
Publisher:
python-publish.yml on mwyau/PyStormTracker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pystormtracker-0.3.0-py3-none-any.whl -
Subject digest:
e430e191ab30da6e3ea14f0a38172a18028e2e4726034b90b9f6042ce7081560 - Sigstore transparency entry: 1059846527
- Sigstore integration time:
-
Permalink:
mwyau/PyStormTracker@03ce86e497b92c3957962edf405a04760ed90261 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/mwyau
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@03ce86e497b92c3957962edf405a04760ed90261 -
Trigger Event:
release
-
Statement type: