Skip to main content

besttracks

Docs Python License PyPI version Publish to PyPI pytest

tracks plot

1. Introduction

Tropical cyclone (TC) best-track datasets are analyzed, maintained, and hosted by several Regional Specialized Meteorological Centers (RSMCs), agencies, or projects all over the world. These agencies include:

RSMC WNP NEP NAT NIO SIO WSP SAT
JTWC X X X X
CMA X
JMA X
NHC X X
IBTrACS X X X X X X

Unfortunately, different agencies use different data formats. This python-based project besttracks, aims to provide a unified interface to access these datasets in different formats, and organizes them into a unified data structure called TCSet and TC, which are based on pandas.DataFrame that are convient for python users. Simple plot of track and intensity is also easy and some basic statistics are also provided.

Up to now, the datasets from the above agencies are supported. It would be good to add more agencies and more formats. We also provide the parser function for CMA operational forecast data (BABJ format), which is also popular in China.


2. How to install

Requirements besttracks is developed under the environment with numpy (=version 1.15.4), pandas (=version 1.0.3), xarray (=version 0.15.1), matplotlib (=version 3.3.1). Older versions of these packages are not well tested.

Note: Older versions of these packages are not well tested. For cartopy, it is highly recommended to use version 0.22.0 or higher, as it can be easily installed via pip and ensures better compatibility with modern Python environments.

Install from github

git clone https://github.com/miniufo/besttracks.git

3. Data Structures

The core data structures of besttracks are TCSet and TC:

3.1 TCSet (Tropical Cyclone List)

A container for a list of tropical cyclones (TC). Each TCSet object represents a collection of tropical cyclones parsed from a specific dataset.

Structure:

TCSet
└── TC Object (Example)
    ├── ID: 1979002S04179 (str)
    ├── ace() (Method)
    │   └── Signature: ()
    ├── binning() (Method)
    │   └── Signature: (var=None, **kwargs)
    ├── change_wind_unit() (Method)
    │   └── Signature: (unit=None)
    ├── copy() (Method)
    │   └── Signature: (copy_records=True)
    ├── duration() (Method)
    │   └── Signature: ()
    ├── fcstTime: 0 (int)
    ├── get_as_xarray() (Method)
    │   └── Signature: (field)
    ├── name: GORDON (str)
    ├── peak_intensity() (Method)
    │   └── Signature: ()
    ├── plot() (Method)
    │   └── Signature: (**kwargs)
    ├── plot_intensity() (Method)
    │   └── Signature: (unit='knot', **kwargs)
    ├── plot_track() (Method)
    │   └── Signature: (**kwargs)
    ├── records (DataFrame)
    │   └── Shape: (101, 6), Columns: ['TIME', 'TYPE', 'LAT', 'LON', 'WND', 'PRS']
    ├── resample() (Method)
    │   └── Signature: (*args, **kwargs)
    ├── sel() (Method)
    │   └── Signature: (cond, copy=True)
    ├── translate_velocity() (Method)
    │   └── Signature: (Rearth=6371200)
    ├── wndunit: knot (str)
    └── year: 1979 (int)

3.2 TC (Single Tropical Cyclone)

A single tropical cyclone object that contains detailed information about the cyclone's track, intensity, and metadata.

Key attributes and methods:

  • ID: Unique identifier for the tropical cyclone.
  • name: Name of the tropical cyclone.
  • records: A pandas.DataFrame containing the time-series data of the cyclone's track and intensity.
    • Columns: ['TIME', 'TYPE', 'LAT', 'LON', 'WND', 'PRS']
  • Methods:
    • plot(): Plot the track and intensity of the cyclone.
    • binning(): Bin the track data into gridded statistics.
    • ace(): Calculate the Accumulated Cyclone Energy (ACE).
    • duration(): Get the total duration of the cyclone.
    • peak_intensity(): Find the peak intensity of the cyclone.
    • change_wind_unit(unit): Convert wind speed units between knots, meters per second, and kilometers per hour.

4. Examples

4.1 Best-track datasets manipulations

Parsing best-track dataset CMA into TCSet would be as simple as:

from besttracks import parse_TCs

# parse dataset from CMA
TCs_CMA = parse_TCs('./CH*.txt', agency='CMA')

# Brief describe the dataset
print(TCs_CMA)

# Plotting all TC tracks
TCs_CMA.plot_tracks()

tracks plot

One can also bin the tracks into gridded statistics (also known as PDF distribution) as:

# binning the tracks into gridded data
TCs_CMA.binning()

binning plot


4.2 A single TC manipulation

Manipulating a single TC is also simple:

# Selecting a single TC
tc = TCs_CMA[-1]

# Briefly descibe the TC
print(tc)

# Plot the TC track and intensity
tc.plot()

tc plot


4.3 Timeseries statistics

TCSet also supports statistical analysis over time space. One can plot the timeseries of TC number and accumulated cyclonic energy (ACE) of a TCSet as:

# plot the climatological timeseries of No. and ACE
TCs_CMA.plot_timeseries(freq='annual')

tc plot

More examples can be found at this notebook

Metadata

Release files for besttracks 0.2.1

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

Source distribution (sdist)

Source distribution for besttracks 0.2.1
File Size Uploaded
besttracks-0.2.1.tar.gz 33.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for besttracks 0.2.1
File Interpreter ABI Platform
besttracks-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 61.5 kB

Release files / besttracks-0.2.1.tar.gz

Download URL besttracks-0.2.1.tar.gz
Size 33.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e5c94a44847352bfc627a8d0ce3ed40917cf858fedca24c74f0bc168c949bcb4
BLAKE2b-256 checksum
How to use checksums
acf8d8d81bef5864129273b8c93d02557d29ddb2da20f6fea9cd780fd665443a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / besttracks-0.2.1-py3-none-any.whl

Download URL besttracks-0.2.1-py3-none-any.whl
Size 28.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d6fc19a1edcb4ca2499276d6cc9340a867f217c61fdfaeeb8b4e9d52f715594f
BLAKE2b-256 checksum
How to use checksums
5263c6e51cf1f924720af60276b257c85b78b3c417a5919d8988c093137d8030
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

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