Skip to main content

A Parallel Object-Oriented Cyclone Tracker in Python

Project description

PyStormTracker

DOI

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 3 Support: Fully migrated from Python 2 with comprehensive type hints.
  • Flexible Data Support: Works with netCDF4 and handles various coordinate naming conventions (lat/lon vs latitude/longitude).
  • 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: Handles masked/missing data correctly and includes automated unit/integration tests.
  • User-Friendly Output: Results are exported directly to CSV 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 generic_filter with a sliding window (default 5x5) 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.

Installation

Prerequisites

  • Python 3.10+
  • (Optional) MS-MPI or OpenMPI for MPI support.

From PyPI (Recommended)

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

pip install PyStormTracker

From Source

  1. Clone the repository:

    git clone https://github.com/mwyau/PyStormTracker.git
    cd PyStormTracker
    
  2. Install the package in editable mode:

    pip install -e .
    

Usage

Once installed, you can use the stormtracker command directly:

stormtracker -i data/test/slp.2012.nc -v slp -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., slp, vo).
--output -o Required. Path to the output CSV file (appends .csv 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).

Examples

Run with Dask (Auto-detected cores):

stormtracker -i input.nc -v slp -o tracks

Run with MPI (Distributed):

mpiexec -n 4 stormtracker -i input.nc -v slp -o tracks -b mpi

Project Structure

  • src/pystormtracker/models/: Data structures (Center, Grid, Tracks).
  • src/pystormtracker/simple/: Implementation of the Simple Tracker logic (SimpleDetector, SimpleLinker).
  • src/pystormtracker/stormtracker.py: CLI orchestration and parallel backends.

Testing

Run the full test suite (unit and integration tests) using pytest:

pytest

Citations

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

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.

License

This project is licensed under the terms found in the LICENSE file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pystormtracker-0.2.2.tar.gz (615.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pystormtracker-0.2.2-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file pystormtracker-0.2.2.tar.gz.

File metadata

  • Download URL: pystormtracker-0.2.2.tar.gz
  • Upload date:
  • Size: 615.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pystormtracker-0.2.2.tar.gz
Algorithm Hash digest
SHA256 731ef12c40a1409a3cba7f5f7d502221fcb708c3e5d6ce2b85f09d0325f2b3d5
MD5 b950e60222887e806f5ccceeff39f4c0
BLAKE2b-256 2a28a6c717b8d13df98ba729ca64c8ee7ae3f96ebe6655c0092f2272931b91e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pystormtracker-0.2.2.tar.gz:

Publisher: python-publish.yml on mwyau/PyStormTracker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pystormtracker-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: pystormtracker-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pystormtracker-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bed0c2d200c6af043d76a313f11d73a7abd5d0ad03fbbfbebdc828cd9b552ce0
MD5 656565460aa2363ff4e0d55f225294bc
BLAKE2b-256 03907bce8e18cf5179bb902ce90a37199302f3ce9d0ac46a284d475b5b5b00e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pystormtracker-0.2.2-py3-none-any.whl:

Publisher: python-publish.yml on mwyau/PyStormTracker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page