Skip to main content

PyStormTracker

CI Documentation Status codecov PyPI version Python versions License Docker GHCR DOI

PyStormTracker is a Python package for cyclone trajectory analysis, implementing the "Simple Tracker" algorithm described in Yau and Chang (2020). It is currently being expanded to include a Python port of the adaptive constraints tracking algorithm from Hodges (1999) (originally in C) and the Accumulated Track Activity metrics from Yau and Chang (2020) (originally in Matlab).

Initially developed at the National Center for Atmospheric Research (NCAR) as part of the 2015 SIParCS program, PyStormTracker leverages task-parallel strategies and tree reduction algorithms to efficiently and accurately process large-scale climate datasets.

Features

  • Modern & Typed: Strictly targets Python 3.11+ with complete type hints and strict mypy compliance.
  • Xarray Native: Leverages xarray for robust, high-performance coordinate-aware processing, lazy data loading, and optimized I/O.
  • Scalable Execution: Supports multiple backends:
    • Dask (Default): Automatically scales to utilize all available CPU cores.
    • MPI: Enables distributed execution across cluster nodes via mpi4py.
    • Serial: Standard sequential execution for debugging or small datasets.
  • Robust Feature Detection: Employs optimized $O(N)$ extrema filtering with robust handling of masked or missing data.
  • Interoperable Output: Exports tracking results to the standard IMILAST intercomparison format (.txt) with human-readable datetime strings.

Technical Methodology

PyStormTracker treats meteorological fields as 2D images, utilizing scipy.ndimage for robust feature detection and tracking:

  • Local Extrema Detection: Employs an optimized sliding window filter to efficiently identify local minima (e.g., cyclones) or maxima (e.g., anticyclones, vorticity).
  • Intensity & Refinement: Applies the discrete Laplacian operator to measure the "sharpness" of the field at each candidate center. This metric resolves duplicate detections, ensuring only the most physically intense point is retained when adjacent pixels are flagged.
  • Spherical Continuity: Uses mode='wrap' for all spatial filters to correctly handle periodic boundary conditions across the Prime Meridian, allowing for seamless global tracking.
  • Trajectory Linking: Connects detected centers across consecutive time steps into continuous trajectories using a nearest-neighbor heuristic linking strategy.

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.
  • Windows Users: Note that the grib optional dependency (via eccodeslib) currently only supports Linux and macOS.

You can install the latest stable version of PyStormTracker directly from PyPI:

Using pip (standard):

pip install PyStormTracker

Using uv (recommended):

# For use as a CLI tool
uv tool install PyStormTracker

# For use as a library in your project
uv add PyStormTracker

From Source

Install with uv (Recommended):

git clone https://github.com/mwyau/PyStormTracker.git
cd PyStormTracker
uv sync

Usage

Once installed, you can use the stormtracker command directly:

stormtracker -i era5_msl_2025-2026_djf_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

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 integration tests).
  • Integration Tests: ONLY long-running integration/regression tests.
  • Full Suite: Everything.

Run fast unit tests only (Default):

uv run pytest

Run ONLY integration tests:

uv run pytest --run-integration

Run everything:

uv run pytest --run-all

Citations

If you use this software in your research, please cite the following:

References

License

This project is licensed under the BSD-3-Clause terms found in the LICENSE file.

Metadata

Release files for PyStormTracker 0.3.3

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

Source distribution (sdist)

Source distribution for PyStormTracker 0.3.3
File Size Uploaded Provenance Actions
pystormtracker-0.3.3.tar.gz 532.6 kB With provenance Details for pystormtracker-0.3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for PyStormTracker 0.3.3
File Interpreter ABI Platform Actions
pystormtracker-0.3.3-py3-none-any.whl Python 3 none any Details for pystormtracker-0.3.3-py3-none-any.whl

Total release size: 550.1 kB

Release files / pystormtracker-0.3.3.tar.gz

Download URL pystormtracker-0.3.3.tar.gz
Size 532.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6c9d3d5ae93425bd747fee034dbf8d8d7a61aa5e6f2700c9b67917de31faca07
BLAKE2b-256 checksum
How to use checksums
8fc0868ba1a4019693a94a973fea7d17d5d52f7c16f0cf22e095523fd5211da4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 10, 2026.

Transparency log

Release files / pystormtracker-0.3.3-py3-none-any.whl

Download URL pystormtracker-0.3.3-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b5abd0387de15d7f70e773ee8830f6bb57eba3487150819aca58739aeeda80a
BLAKE2b-256 checksum
How to use checksums
1e02e8ffd615c9f01f78fa05db7ef1a7e6dcb575ead39c268af06b8971686c4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 10, 2026.

Transparency log

Security for PyStormTracker 0.3.3

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 pystormtracker-0.3.3.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 Mar 10, 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