tctrack 0.3__tar.gz → 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tctrack-0.3 → tctrack-1.0.0}/.github/workflows/codequality.yaml +5 -5
- {tctrack-0.3 → tctrack-1.0.0}/.github/workflows/release.yaml +3 -3
- {tctrack-0.3 → tctrack-1.0.0}/.github/workflows/unit-tests.yaml +19 -29
- {tctrack-0.3 → tctrack-1.0.0}/.pre-commit-config.yaml +3 -2
- {tctrack-0.3 → tctrack-1.0.0}/.readthedocs.yaml +1 -0
- tctrack-1.0.0/Dockerfile +14 -0
- {tctrack-0.3 → tctrack-1.0.0}/PKG-INFO +23 -14
- {tctrack-0.3 → tctrack-1.0.0}/README.md +7 -6
- tctrack-1.0.0/data/machine_learning/README.md +35 -0
- tctrack-1.0.0/data/machine_learning/era5_dikeledi_2025-01-10.nc +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/docs/api/index.rst +1 -0
- tctrack-1.0.0/docs/api/machine_learning_api.rst +53 -0
- {tctrack-0.3 → tctrack-1.0.0}/docs/api/tempest_extremes_api.rst +11 -0
- {tctrack-0.3 → tctrack-1.0.0}/docs/api/track_api.rst +2 -0
- {tctrack-0.3 → tctrack-1.0.0}/docs/api/tstorms_api.rst +2 -0
- tctrack-1.0.0/docs/api/utils_api.rst +5 -0
- {tctrack-0.3 → tctrack-1.0.0}/docs/conf.py +3 -0
- {tctrack-0.3 → tctrack-1.0.0}/docs/data/output_file.rst +5 -2
- {tctrack-0.3 → tctrack-1.0.0}/docs/data/preprocessing_data.rst +1 -1
- {tctrack-0.3 → tctrack-1.0.0}/docs/developer/adding_algorithms.rst +10 -8
- tctrack-1.0.0/docs/flowcharts/FlowChart_MLTracker.mmd +91 -0
- tctrack-1.0.0/docs/flowcharts/FlowChart_TCT.mmd +57 -0
- {tctrack-0.3 → tctrack-1.0.0}/docs/getting-started/index.rst +42 -6
- tctrack-1.0.0/docs/getting-started/tutorial.rst +42 -0
- tctrack-1.0.0/docs/getting-started/tutorial_batching.nblink +3 -0
- tctrack-1.0.0/docs/getting-started/tutorial_tempest_extremes.nblink +3 -0
- tctrack-1.0.0/docs/getting-started/tutorial_tstorms.nblink +3 -0
- {tctrack-0.3 → tctrack-1.0.0}/docs/index.rst +5 -2
- tctrack-1.0.0/docs/references.rst +17 -0
- {tctrack-0.3 → tctrack-1.0.0}/docs/tracking-algorithms/index.rst +1 -0
- tctrack-1.0.0/docs/tracking-algorithms/machine_learning.rst +236 -0
- {tctrack-0.3 → tctrack-1.0.0}/docs/tracking-algorithms/tempest_extremes.rst +64 -19
- {tctrack-0.3 → tctrack-1.0.0}/docs/tracking-algorithms/track.rst +37 -12
- {tctrack-0.3 → tctrack-1.0.0}/docs/tracking-algorithms/tstorms.rst +76 -50
- tctrack-1.0.0/environment.yaml +10 -0
- {tctrack-0.3 → tctrack-1.0.0}/pyproject.toml +33 -9
- tctrack-1.0.0/src/tctrack/__init__.py +21 -0
- tctrack-1.0.0/src/tctrack/build_db/README.md +89 -0
- tctrack-1.0.0/src/tctrack/build_db/__init__.py +1 -0
- tctrack-1.0.0/src/tctrack/build_db/build_db.py +505 -0
- tctrack-1.0.0/src/tctrack/build_db/converters/__init__.py +5 -0
- tctrack-1.0.0/src/tctrack/build_db/converters/base.py +21 -0
- tctrack-1.0.0/src/tctrack/build_db/converters/ibtracs.py +159 -0
- tctrack-1.0.0/src/tctrack/build_db/schema.sql +96 -0
- tctrack-1.0.0/src/tctrack/build_db/tctrack_convert.py +71 -0
- tctrack-1.0.0/src/tctrack/core/ml_tracker.py +120 -0
- {tctrack-0.3 → tctrack-1.0.0}/src/tctrack/core/tracker.py +113 -20
- tctrack-1.0.0/src/tctrack/core/tracker_template.py +168 -0
- {tctrack-0.3 → tctrack-1.0.0}/src/tctrack/core/trajectory.py +18 -4
- tctrack-1.0.0/src/tctrack/machine_learning/__init__.py +15 -0
- tctrack-1.0.0/src/tctrack/machine_learning/cyclone_track_ml.py +870 -0
- tctrack-1.0.0/src/tctrack/machine_learning/data/normalisation_parameters.nc +0 -0
- tctrack-1.0.0/src/tctrack/machine_learning/parameters.py +140 -0
- {tctrack-0.3 → tctrack-1.0.0}/src/tctrack/preprocessing.py +348 -93
- {tctrack-0.3 → tctrack-1.0.0}/src/tctrack/tempest_extremes/__init__.py +10 -2
- tctrack-1.0.0/src/tctrack/tempest_extremes/parameters.py +786 -0
- {tctrack-0.3 → tctrack-1.0.0}/src/tctrack/tempest_extremes/tempest_extremes.py +306 -503
- {tctrack-0.3 → tctrack-1.0.0}/src/tctrack/track/__init__.py +3 -4
- tctrack-1.0.0/src/tctrack/track/parameters.py +95 -0
- {tctrack-0.3 → tctrack-1.0.0}/src/tctrack/track/track.py +113 -76
- {tctrack-0.3 → tctrack-1.0.0}/src/tctrack/tstorms/__init__.py +4 -2
- tctrack-1.0.0/src/tctrack/tstorms/parameters.py +333 -0
- {tctrack-0.3 → tctrack-1.0.0}/src/tctrack/tstorms/tstorms.py +249 -258
- {tctrack-0.3 → tctrack-1.0.0}/src/tctrack/utils/__init__.py +2 -0
- tctrack-1.0.0/src/tctrack/utils/batching.py +553 -0
- {tctrack-0.3 → tctrack-1.0.0}/src/tctrack/utils/metadata.py +1 -1
- {tctrack-0.3 → tctrack-1.0.0}/src/tctrack.egg-info/PKG-INFO +23 -14
- {tctrack-0.3 → tctrack-1.0.0}/src/tctrack.egg-info/SOURCES.txt +43 -5
- tctrack-1.0.0/src/tctrack.egg-info/entry_points.txt +3 -0
- tctrack-1.0.0/src/tctrack.egg-info/requires.txt +40 -0
- {tctrack-0.3 → tctrack-1.0.0}/src/tctrack.egg-info/scm_file_list.json +92 -55
- tctrack-1.0.0/src/tctrack.egg-info/scm_version.json +8 -0
- tctrack-1.0.0/tests/integration/test_integration_ml_pipeline.py +128 -0
- {tctrack-0.3 → tctrack-1.0.0}/tests/integration/test_tracker_integration.py +3 -2
- tctrack-1.0.0/tests/unit/build_db/converters/test_ibtracs.py +458 -0
- tctrack-1.0.0/tests/unit/build_db/test_build_db.py +412 -0
- tctrack-1.0.0/tests/unit/build_db/test_tctrack_convert.py +62 -0
- tctrack-1.0.0/tests/unit/build_db/test_tracks.nc +0 -0
- tctrack-1.0.0/tests/unit/build_db/test_tracks_se.nc +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/tests/unit/core/test_tracker.py +121 -14
- {tctrack-0.3 → tctrack-1.0.0}/tests/unit/core/test_trajectory.py +1 -1
- tctrack-1.0.0/tests/unit/machine_learning/test_cyclone_track_ml.py +746 -0
- {tctrack-0.3 → tctrack-1.0.0}/tests/unit/preprocessing/test_preprocessing.py +149 -12
- {tctrack-0.3 → tctrack-1.0.0}/tests/unit/tempest_extremes/test_tempest_extremes.py +641 -114
- {tctrack-0.3 → tctrack-1.0.0}/tests/unit/track/test_track.py +221 -117
- {tctrack-0.3 → tctrack-1.0.0}/tests/unit/tstorms/test_tstorms.py +262 -21
- tctrack-1.0.0/tests/unit/utils/test_batching.py +706 -0
- {tctrack-0.3 → tctrack-1.0.0}/tests/unit/utils/test_metadata.py +2 -2
- tctrack-1.0.0/tutorial/README.md +19 -0
- tctrack-1.0.0/tutorial/batching.ipynb +433 -0
- tctrack-1.0.0/tutorial/fetch_data.py +140 -0
- tctrack-1.0.0/tutorial/install_tempest_extremes.sh +28 -0
- tctrack-1.0.0/tutorial/install_tstorms.sh +25 -0
- tctrack-1.0.0/tutorial/run_ml_tracker.py +19 -0
- tctrack-1.0.0/tutorial/tempest_extremes.ipynb +559 -0
- tctrack-1.0.0/tutorial/tstorms.ipynb +555 -0
- tctrack-0.3/docs/api/utils_api.rst +0 -8
- tctrack-0.3/docs/getting-started/tutorial.rst +0 -154
- tctrack-0.3/docs/references.rst +0 -11
- tctrack-0.3/src/tctrack/__init__.py +0 -5
- tctrack-0.3/src/tctrack.egg-info/requires.txt +0 -30
- tctrack-0.3/src/tctrack.egg-info/scm_version.json +0 -8
- tctrack-0.3/tutorial/README.md +0 -15
- tctrack-0.3/tutorial/fetch_data.sh +0 -31
- tctrack-0.3/tutorial/install_tempest_extremes.sh +0 -22
- tctrack-0.3/tutorial/install_tstorms.sh +0 -19
- tctrack-0.3/tutorial/plot_tracks.py +0 -82
- tctrack-0.3/tutorial/preprocess_data.py +0 -151
- tctrack-0.3/tutorial/run_tempest_extremes.py +0 -56
- tctrack-0.3/tutorial/run_tstorms.py +0 -45
- {tctrack-0.3 → tctrack-1.0.0}/.gitignore +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/LICENSE +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/docs/Makefile +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/docs/api/core_api.rst +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/docs/api/preprocessing_api.rst +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/docs/data/index.rst +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/docs/developer/guidelines.rst +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/docs/developer/index.rst +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/docs/images/TCTrack_Logo.svg +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/docs/images/data_tracks_plot.png +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/docs/images/inigo_inspire.png +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/docs/make.bat +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/setup.cfg +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/setup.py +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/src/tctrack/core/__init__.py +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/src/tctrack/core/netcdf.py +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/src/tctrack.egg-info/dependency_links.txt +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/src/tctrack.egg-info/top_level.txt +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/tests/conftest.py +0 -0
- {tctrack-0.3 → tctrack-1.0.0}/tests/unit/core/test_netcdf.py +0 -0
|
@@ -32,18 +32,18 @@ jobs:
|
|
|
32
32
|
- name: Checkout code
|
|
33
33
|
with:
|
|
34
34
|
persist-credentials: false
|
|
35
|
-
uses: actions/checkout@
|
|
35
|
+
uses: actions/checkout@v7
|
|
36
36
|
|
|
37
37
|
- name: Install Python
|
|
38
|
-
uses: actions/setup-python@
|
|
38
|
+
uses: actions/setup-python@v7
|
|
39
39
|
with:
|
|
40
|
-
python-version: '3.
|
|
41
|
-
|
|
40
|
+
python-version: '3.14'
|
|
41
|
+
|
|
42
42
|
- name: Install Package and Dependencies
|
|
43
43
|
run: |
|
|
44
|
-
python -m pip install --upgrade pip
|
|
45
44
|
python -m venv tctrack_venv
|
|
46
45
|
. tctrack_venv/bin/activate
|
|
46
|
+
pip install --upgrade pip
|
|
47
47
|
pip install .[lint,doc]
|
|
48
48
|
|
|
49
49
|
- name: ruff format tctrack
|
|
@@ -4,7 +4,7 @@ name: release
|
|
|
4
4
|
on:
|
|
5
5
|
push:
|
|
6
6
|
tags:
|
|
7
|
-
- "v*"
|
|
7
|
+
- "v[0-9]*.[0-9]*.[0-9]*"
|
|
8
8
|
|
|
9
9
|
jobs:
|
|
10
10
|
|
|
@@ -14,12 +14,12 @@ jobs:
|
|
|
14
14
|
|
|
15
15
|
steps:
|
|
16
16
|
- name: Checkout repo
|
|
17
|
-
uses: actions/checkout@
|
|
17
|
+
uses: actions/checkout@v7
|
|
18
18
|
with:
|
|
19
19
|
fetch-depth: 0 # REQUIRED for setuptools_scm
|
|
20
20
|
|
|
21
21
|
- name: Install Python
|
|
22
|
-
uses: actions/setup-python@
|
|
22
|
+
uses: actions/setup-python@v7
|
|
23
23
|
with:
|
|
24
24
|
python-version: "3.14"
|
|
25
25
|
|
|
@@ -30,46 +30,36 @@ jobs:
|
|
|
30
30
|
matrix:
|
|
31
31
|
# Supported Python versions on Linux Ubuntu
|
|
32
32
|
os: ["ubuntu-latest"]
|
|
33
|
-
python-version: ["3.14", "3.13", "3.12", "3.11"
|
|
33
|
+
python-version: ["3.14", "3.13", "3.12", "3.11"]
|
|
34
34
|
# test latest python version on macOS
|
|
35
35
|
include:
|
|
36
36
|
- os: macos-latest
|
|
37
37
|
python-version: "3.14"
|
|
38
38
|
|
|
39
39
|
steps:
|
|
40
|
-
- name: Install system dependencies (Ubuntu)
|
|
41
|
-
if: runner.os == 'Linux'
|
|
42
|
-
run: sudo apt-get update && sudo apt-get install -y libudunits2-dev
|
|
43
|
-
|
|
44
|
-
- name: Install system dependencies (macOS)
|
|
45
|
-
if: runner.os == 'macOS'
|
|
46
|
-
run: |
|
|
47
|
-
brew install udunits
|
|
48
|
-
echo "LD_LIBRARY_PATH=/opt/homebrew/lib" >> $GITHUB_ENV
|
|
49
|
-
echo "DYLD_LIBRARY_PATH=/opt/homebrew/lib" >> $GITHUB_ENV
|
|
50
|
-
echo "UDUNITS2_XML_PATH=/opt/homebrew/share/udunits/udunits2.xml" >> $GITHUB_ENV
|
|
51
|
-
|
|
52
|
-
# Checks-out repository under $GITHUB_WORKSPACE, so job can access it
|
|
53
40
|
- name: Checkout code
|
|
54
41
|
with:
|
|
55
42
|
persist-credentials: false
|
|
56
|
-
uses: actions/checkout@
|
|
43
|
+
uses: actions/checkout@v7
|
|
57
44
|
|
|
58
|
-
- name:
|
|
59
|
-
uses:
|
|
45
|
+
- name: Set up micromamba environment
|
|
46
|
+
uses: mamba-org/setup-micromamba@v3
|
|
60
47
|
with:
|
|
61
|
-
|
|
62
|
-
|
|
48
|
+
environment-name: tctrack-env
|
|
49
|
+
create-args: >-
|
|
50
|
+
python=${{ matrix.python-version }}
|
|
51
|
+
udunits2
|
|
52
|
+
esmpy
|
|
53
|
+
pytorch-cpu
|
|
54
|
+
cache-environment: true
|
|
55
|
+
|
|
63
56
|
- name: Install Package and Dependencies
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
python -m venv tctrack_venv
|
|
67
|
-
. tctrack_venv/bin/activate
|
|
68
|
-
pip install .[test]
|
|
57
|
+
shell: micromamba-shell {0}
|
|
58
|
+
run: pip install .[test]
|
|
69
59
|
|
|
70
60
|
- name: Run unit tests
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
61
|
+
shell: micromamba-shell {0}
|
|
62
|
+
# This prevents networking to avoid a bug due to esmpy initialising MPI
|
|
63
|
+
env:
|
|
64
|
+
UCX_TLS: self,sm
|
|
65
|
+
run: pytest tests/unit
|
|
@@ -7,16 +7,17 @@ repos:
|
|
|
7
7
|
rev: v0.15.17
|
|
8
8
|
hooks:
|
|
9
9
|
- id: ruff-check
|
|
10
|
-
files: (src|tests)/.*\.py
|
|
10
|
+
files: (src|tests)/.*\.py|tutorial/.*\.ipynb
|
|
11
11
|
args: [ --fix ]
|
|
12
12
|
- id: ruff-format
|
|
13
|
-
files: (src|tests)/.*\.py
|
|
13
|
+
files: (src|tests)/.*\.py|tutorial/.*\.ipynb
|
|
14
14
|
|
|
15
15
|
# Mypy type checking
|
|
16
16
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
17
17
|
rev: v2.1.0
|
|
18
18
|
hooks:
|
|
19
19
|
- id: mypy
|
|
20
|
+
additional_dependencies: ["pytest==7.4.4"]
|
|
20
21
|
|
|
21
22
|
# Docs formatting with blackdoc
|
|
22
23
|
- repo: https://github.com/keewis/blackdoc
|
tctrack-1.0.0/Dockerfile
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
FROM mambaorg/micromamba:2.10.0
|
|
2
|
+
|
|
3
|
+
COPY --chown=$MAMBA_USER:$MAMBA_USER ./environment.yaml /tmp/environment.yaml
|
|
4
|
+
RUN micromamba install -y -n base -f /tmp/environment.yaml && \
|
|
5
|
+
micromamba clean --all --yes
|
|
6
|
+
|
|
7
|
+
USER root
|
|
8
|
+
|
|
9
|
+
RUN apt-get update
|
|
10
|
+
RUN apt-get -y install git
|
|
11
|
+
|
|
12
|
+
USER $MAMBA_USER
|
|
13
|
+
|
|
14
|
+
ENTRYPOINT ["/usr/local/bin/_entrypoint.sh", "/bin/bash"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tctrack
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: A Python package for generating tropical cyclone tracks.
|
|
5
5
|
Author-email: Jack Atkinson <jwa34@cam.ac.uk>, Sam Avis <sa2329@cam.ac.uk>
|
|
6
6
|
License-Expression: GPL-3.0-or-later
|
|
@@ -12,7 +12,6 @@ Classifier: Development Status :: 4 - Beta
|
|
|
12
12
|
Classifier: Natural Language :: English
|
|
13
13
|
Classifier: Programming Language :: Python
|
|
14
14
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.13
|
|
@@ -22,30 +21,39 @@ Classifier: Operating System :: Unix
|
|
|
22
21
|
Classifier: Topic :: Scientific/Engineering
|
|
23
22
|
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
|
|
24
23
|
Classifier: Intended Audience :: Science/Research
|
|
25
|
-
Requires-Python: >=3.
|
|
24
|
+
Requires-Python: >=3.11
|
|
26
25
|
Description-Content-Type: text/markdown
|
|
27
26
|
License-File: LICENSE
|
|
28
27
|
Requires-Dist: h5py>=3.16.0
|
|
29
|
-
Requires-Dist: cf-python>=3.19.0;
|
|
30
|
-
Requires-Dist: cf-python
|
|
28
|
+
Requires-Dist: cf-python>=3.19.0; platform_system != "Windows"
|
|
29
|
+
Requires-Dist: cf-python<=3.20.1,>=3.19.0; platform_system == "Windows"
|
|
31
30
|
Requires-Dist: cftime
|
|
31
|
+
Requires-Dist: torch
|
|
32
|
+
Requires-Dist: huggingface_hub
|
|
33
|
+
Requires-Dist: scipy
|
|
32
34
|
Provides-Extra: test
|
|
33
35
|
Requires-Dist: pytest; extra == "test"
|
|
34
36
|
Requires-Dist: pytest-mock; extra == "test"
|
|
35
37
|
Requires-Dist: xarray; extra == "test"
|
|
36
38
|
Provides-Extra: lint
|
|
37
|
-
Requires-Dist: ruff; extra == "lint"
|
|
39
|
+
Requires-Dist: ruff==0.15.17; extra == "lint"
|
|
38
40
|
Requires-Dist: blackdoc>=0.4.2; extra == "lint"
|
|
39
41
|
Requires-Dist: black>=25.9.0; extra == "lint"
|
|
40
|
-
Requires-Dist: mypy; extra == "lint"
|
|
42
|
+
Requires-Dist: mypy==2.4.0; extra == "lint"
|
|
41
43
|
Requires-Dist: pytest; extra == "lint"
|
|
42
44
|
Requires-Dist: xarray; extra == "lint"
|
|
43
45
|
Provides-Extra: doc
|
|
44
46
|
Requires-Dist: sphinx<8.2.0; extra == "doc"
|
|
45
47
|
Requires-Dist: sphinx_rtd_theme; extra == "doc"
|
|
46
48
|
Requires-Dist: sphinx_autodoc_typehints; extra == "doc"
|
|
49
|
+
Requires-Dist: nbsphinx; extra == "doc"
|
|
50
|
+
Requires-Dist: nbsphinx_link; extra == "doc"
|
|
51
|
+
Provides-Extra: tutorial
|
|
52
|
+
Requires-Dist: jupyter; extra == "tutorial"
|
|
53
|
+
Requires-Dist: matplotlib; extra == "tutorial"
|
|
54
|
+
Requires-Dist: huracanpy; extra == "tutorial"
|
|
47
55
|
Provides-Extra: dev
|
|
48
|
-
Requires-Dist: tctrack[doc,lint,test]; extra == "dev"
|
|
56
|
+
Requires-Dist: tctrack[doc,lint,test,tutorial]; extra == "dev"
|
|
49
57
|
Requires-Dist: pre-commit; extra == "dev"
|
|
50
58
|
Dynamic: license-file
|
|
51
59
|
|
|
@@ -59,7 +67,7 @@ Dynamic: license-file
|
|
|
59
67
|

|
|
60
68
|
[](https://tctrack.readthedocs.io/en/latest/?badge=latest)
|
|
61
69
|
[](https://github.com/astral-sh/ruff)
|
|
62
|
-
[](https://www.python.org/downloads/)
|
|
63
71
|
[](https://joss.theoj.org/papers/5bfc7127397fb0fd3583de541eab4c49)
|
|
64
72
|
|
|
65
73
|
|
|
@@ -67,20 +75,21 @@ TCTrack is a Python library providing bindings to tracking algorithms for tropic
|
|
|
67
75
|
cyclones in an accessible manner to generate high-quality and
|
|
68
76
|
[FAIR](https://en.wikipedia.org/wiki/FAIR_data) output data.
|
|
69
77
|
|
|
70
|
-
It can be used for tracking cyclones
|
|
71
|
-
|
|
78
|
+
It can be used for tracking cyclones – or, more broadly, for tracking different types of
|
|
79
|
+
features – in simulations and observations, and to compare the output of different
|
|
80
|
+
algorithms for a variety of data sources.
|
|
72
81
|
|
|
73
82
|
|
|
74
83
|
## Installation
|
|
75
84
|
|
|
76
85
|
### Dependencies
|
|
77
|
-
The package requires Python 3 (>=3.
|
|
86
|
+
The package requires Python 3 (>=3.11, <3.15).
|
|
78
87
|
|
|
79
88
|
### Package Installation
|
|
80
89
|
We recommend using a Conda virtual environment for TCTrack in order to simplify the
|
|
81
|
-
installation of dependencies (
|
|
90
|
+
installation of dependencies (esmpy/ESMF, UDUNITS).
|
|
82
91
|
```sh
|
|
83
|
-
conda create -n tctrack-env -c conda-forge
|
|
92
|
+
conda create -n tctrack-env -c conda-forge python=3.14 udunits2 esmpy pytorch
|
|
84
93
|
conda activate tctrack-env
|
|
85
94
|
```
|
|
86
95
|
When finished using TCTrack this can be turned off with `conda deactivate`.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|

|
|
9
9
|
[](https://tctrack.readthedocs.io/en/latest/?badge=latest)
|
|
10
10
|
[](https://github.com/astral-sh/ruff)
|
|
11
|
-
[](https://www.python.org/downloads/)
|
|
12
12
|
[](https://joss.theoj.org/papers/5bfc7127397fb0fd3583de541eab4c49)
|
|
13
13
|
|
|
14
14
|
|
|
@@ -16,20 +16,21 @@ TCTrack is a Python library providing bindings to tracking algorithms for tropic
|
|
|
16
16
|
cyclones in an accessible manner to generate high-quality and
|
|
17
17
|
[FAIR](https://en.wikipedia.org/wiki/FAIR_data) output data.
|
|
18
18
|
|
|
19
|
-
It can be used for tracking cyclones
|
|
20
|
-
|
|
19
|
+
It can be used for tracking cyclones – or, more broadly, for tracking different types of
|
|
20
|
+
features – in simulations and observations, and to compare the output of different
|
|
21
|
+
algorithms for a variety of data sources.
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
## Installation
|
|
24
25
|
|
|
25
26
|
### Dependencies
|
|
26
|
-
The package requires Python 3 (>=3.
|
|
27
|
+
The package requires Python 3 (>=3.11, <3.15).
|
|
27
28
|
|
|
28
29
|
### Package Installation
|
|
29
30
|
We recommend using a Conda virtual environment for TCTrack in order to simplify the
|
|
30
|
-
installation of dependencies (
|
|
31
|
+
installation of dependencies (esmpy/ESMF, UDUNITS).
|
|
31
32
|
```sh
|
|
32
|
-
conda create -n tctrack-env -c conda-forge
|
|
33
|
+
conda create -n tctrack-env -c conda-forge python=3.14 udunits2 esmpy pytorch
|
|
33
34
|
conda activate tctrack-env
|
|
34
35
|
```
|
|
35
36
|
When finished using TCTrack this can be turned off with `conda deactivate`.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Sample data for the machine-learning tracker
|
|
2
|
+
|
|
3
|
+
`era5_dikeledi_2025-01-10.nc` is a small ERA5 subset used by the machine-learning
|
|
4
|
+
tracker's tests and tutorial. It contains the input variables of
|
|
5
|
+
`tctrack.machine_learning.MLTracker` for the period in which Cyclone Dikeledi crossed
|
|
6
|
+
the northern Mozambique Channel.
|
|
7
|
+
|
|
8
|
+
| | |
|
|
9
|
+
|---|---|
|
|
10
|
+
| Time | 2025-01-10 00:00 to 2025-01-12 06:00 UTC, 6-hourly (10 timesteps) |
|
|
11
|
+
| Region | 22.25°S to 2.5°S, 41.0°E to 60.75°E (80 × 80 points, 0.25° spacing) |
|
|
12
|
+
| Pressure levels | 1000, 750 and 500 hPa |
|
|
13
|
+
| Pressure-level variables | relative humidity, air temperature, eastward wind, northward wind, relative vorticity |
|
|
14
|
+
| Surface variables | sea surface temperature (`sst`), 2 m temperature (`t2m`) |
|
|
15
|
+
|
|
16
|
+
Run on this file with the default model, the tracker finds Dikeledi at a threshold of
|
|
17
|
+
0.25 within about 1 degree of the IBTrACS positions, along with some spurious tracks.
|
|
18
|
+
|
|
19
|
+
## Source and licence
|
|
20
|
+
|
|
21
|
+
Generated from ERA5 reanalysis data by cropping to the region and period above. No other
|
|
22
|
+
processing was applied.
|
|
23
|
+
|
|
24
|
+
> Hersbach, H., et al. (2023): ERA5 hourly data on pressure levels from 1940 to
|
|
25
|
+
> present. Copernicus Climate Change Service (C3S) Climate Data Store (CDS).
|
|
26
|
+
> DOI: [10.24381/cds.bd0915c6](https://doi.org/10.24381/cds.bd0915c6)
|
|
27
|
+
>
|
|
28
|
+
> Hersbach, H., et al. (2023): ERA5 hourly data on single levels from 1940 to
|
|
29
|
+
> present. Copernicus Climate Change Service (C3S) Climate Data Store (CDS).
|
|
30
|
+
> DOI: [10.24381/cds.adbb2d47](https://doi.org/10.24381/cds.adbb2d47)
|
|
31
|
+
|
|
32
|
+
Contains modified Copernicus Climate Change Service information 2025. Neither the
|
|
33
|
+
European Commission nor ECMWF is responsible for any use that may be made of the
|
|
34
|
+
information it contains. ERA5 is distributed under the
|
|
35
|
+
[CC-BY 4.0](https://creativecommons.org/licenses/by/4.0/) licence.
|
|
Binary file
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
Machine Learning
|
|
2
|
+
================
|
|
3
|
+
|
|
4
|
+
The machine learning (ML) tracker detects tropical cyclones using a U-Net
|
|
5
|
+
segmentation model, and then links the detections into trajectories. The model
|
|
6
|
+
weights are downloaded from a HuggingFace Hub repository (or supplied locally)
|
|
7
|
+
rather than wrapping an external executable.
|
|
8
|
+
|
|
9
|
+
The model and its training pipeline are described in the reference `cyclone-track-ml
|
|
10
|
+
<https://github.com/robert-edwin-rouse/cyclone-track-ml>`_ repository.
|
|
11
|
+
|
|
12
|
+
For an overview of the functionalities, installation, and usage see the
|
|
13
|
+
:doc:`Machine Learning section of the documentation <../tracking-algorithms/machine_learning>`.
|
|
14
|
+
|
|
15
|
+
.. py:module:: tctrack.machine_learning
|
|
16
|
+
|
|
17
|
+
.. autoclass:: MLTracker
|
|
18
|
+
:members:
|
|
19
|
+
:undoc-members:
|
|
20
|
+
:show-inheritance:
|
|
21
|
+
:inherited-members:
|
|
22
|
+
:exclude-members: model
|
|
23
|
+
|
|
24
|
+
.. autoclass:: MLParameters
|
|
25
|
+
:members:
|
|
26
|
+
:undoc-members:
|
|
27
|
+
:show-inheritance:
|
|
28
|
+
:inherited-members:
|
|
29
|
+
|
|
30
|
+
.. autoclass:: MLStitchParameters
|
|
31
|
+
:members:
|
|
32
|
+
:undoc-members:
|
|
33
|
+
:show-inheritance:
|
|
34
|
+
:inherited-members:
|
|
35
|
+
|
|
36
|
+
.. autofunction:: parameter_set
|
|
37
|
+
|
|
38
|
+
The classes below are base classes for adding other machine learning tracking
|
|
39
|
+
algorithms to TCTrack. They are not intended to be used directly.
|
|
40
|
+
|
|
41
|
+
.. py:module:: tctrack.core.ml_tracker
|
|
42
|
+
:no-index:
|
|
43
|
+
|
|
44
|
+
.. autoclass:: tctrack.core.ml_tracker.TCMLParameters
|
|
45
|
+
:members:
|
|
46
|
+
:undoc-members:
|
|
47
|
+
:show-inheritance:
|
|
48
|
+
|
|
49
|
+
.. autoclass:: tctrack.core.ml_tracker.TCMLTracker
|
|
50
|
+
:members:
|
|
51
|
+
:undoc-members:
|
|
52
|
+
:show-inheritance:
|
|
53
|
+
:exclude-members: model
|
|
@@ -27,11 +27,22 @@ For an overview of the functionalities, installation, and usage see the
|
|
|
27
27
|
:undoc-members:
|
|
28
28
|
:show-inheritance:
|
|
29
29
|
|
|
30
|
+
.. autofunction:: parameter_set
|
|
31
|
+
|
|
32
|
+
.. autofunction:: parameter_set_uz
|
|
33
|
+
|
|
34
|
+
.. autofunction:: parameter_set_owz
|
|
35
|
+
|
|
30
36
|
.. autoclass:: TEContour
|
|
31
37
|
:members:
|
|
32
38
|
:undoc-members:
|
|
33
39
|
:show-inheritance:
|
|
34
40
|
|
|
41
|
+
.. autoclass:: TEDetectThreshold
|
|
42
|
+
:members:
|
|
43
|
+
:undoc-members:
|
|
44
|
+
:show-inheritance:
|
|
45
|
+
|
|
35
46
|
.. autoclass:: TEOutputCommand
|
|
36
47
|
:members:
|
|
37
48
|
:undoc-members:
|
|
@@ -33,6 +33,8 @@ extensions = [
|
|
|
33
33
|
"sphinx.ext.autodoc", # pull in documentation from docstrings
|
|
34
34
|
"sphinx_autodoc_typehints", # use type hints from code/docstrings
|
|
35
35
|
"sphinx.ext.autosectionlabel", # Auto-generate reference labels for sections
|
|
36
|
+
"nbsphinx", # render the tutorial notebooks
|
|
37
|
+
"nbsphinx_link", # link to notebooks outside the docs directory
|
|
36
38
|
]
|
|
37
39
|
|
|
38
40
|
templates_path = ["_templates"]
|
|
@@ -48,3 +50,4 @@ html_static_path = ["_static"]
|
|
|
48
50
|
autodoc_member_order = "bysource"
|
|
49
51
|
napoleon_preprocess_types = True
|
|
50
52
|
autosectionlabel_prefix_document = True
|
|
53
|
+
rst_prolog = ".. |br| raw:: html\n\n <br>" # linebreaks with |br|
|
|
@@ -127,13 +127,16 @@ Files always include two
|
|
|
127
127
|
- **start_flag**
|
|
128
128
|
|
|
129
129
|
- *Dimensions*: ``(trajectory)``
|
|
130
|
+
- *Attributes* include ``flag_interval``, recording the interval used.
|
|
130
131
|
|
|
131
132
|
- **end_flag**
|
|
132
133
|
|
|
133
134
|
- *Dimensions*: ``(trajectory)``
|
|
135
|
+
- *Attributes* include ``flag_interval``, recording the interval used.
|
|
134
136
|
|
|
135
|
-
These indicate any tracks that start or end within
|
|
136
|
-
|
|
137
|
+
These indicate any tracks that start or end within the interval passed to
|
|
138
|
+
``TCTracker.to_netcdf(..., flag_interval=...)`` of the input dataset bounds and may
|
|
139
|
+
therefore extend outside this range. The default interval is 1 day.
|
|
137
140
|
|
|
138
141
|
Global Attributes
|
|
139
142
|
^^^^^^^^^^^^^^^^^
|
|
@@ -173,7 +173,7 @@ Using TCTrack:
|
|
|
173
173
|
.. code-block:: python
|
|
174
174
|
|
|
175
175
|
tctrack.preprocessing.calculate_vorticity(
|
|
176
|
-
"u_file.nc", "v_file.nc", output_file="vorticity_file.nc"
|
|
176
|
+
["u_file.nc", "v_file.nc"], output_file="vorticity_file.nc"
|
|
177
177
|
)
|
|
178
178
|
|
|
179
179
|
Or to take a mean over a coordinate:
|
|
@@ -76,15 +76,18 @@ The class must contain a number of methods prescribed by the base Tracker class:
|
|
|
76
76
|
|
|
77
77
|
* an ``__init__`` method to take parameter classes as inputs and assign to internal attributes.
|
|
78
78
|
This should perform any compatibility checking of inputs and raise warnings as required.
|
|
79
|
-
* :meth:`~TCTracker.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
* :meth:`~TCTracker._parameters` to return a list of the parameters objects so that they
|
|
80
|
+
are accessible by the base class.
|
|
81
|
+
* :meth:`~TCTracker._set_metadata` to set variable, and time metadata. Parameters should
|
|
82
|
+
be added to global metadata in json format and the time and variable metadata should
|
|
83
|
+
be set appropriately based on the input data and using the
|
|
84
|
+
:class:`TCTrackerTimeMetadata` and :class:`TCTrackerMetadata` classes.
|
|
84
85
|
* :meth:`~TCTracker.read_trajectories` to read any outputs generated by the tracking
|
|
85
86
|
algorithm and parse them into a list of :class:`Trajectory`.
|
|
86
87
|
This will be called by :meth:`TCTracker.to_netcdf` when converting the trajectories
|
|
87
|
-
into CF-compliant NetCDF output.
|
|
88
|
+
into CF-compliant NetCDF output. If the algorithm doesn't produce an intermediate
|
|
89
|
+
output file then this function can be left blank and the `trajectories` argument
|
|
90
|
+
should be provided to :meth:`~TCTracker.to_netcdf` instead.
|
|
88
91
|
* :meth:`~TCTracker.run_tracker` that will perform end-to-end tracking, reading inputs and generating
|
|
89
92
|
tracks as cf-compliant NetCDF output.
|
|
90
93
|
This is intended to provide easy top-level usage and match the interface of other
|
|
@@ -95,8 +98,7 @@ The class must contain a number of methods prescribed by the base Tracker class:
|
|
|
95
98
|
:meth:`~TCTracker.read_trajectories` to a :doc:`CF-conventions compliant NetCDF file
|
|
96
99
|
<../data/output_file>`.
|
|
97
100
|
|
|
98
|
-
|
|
99
|
-
class.
|
|
101
|
+
A template with these methods is provided in ``src/tctrack/core/tracker_template.py``.
|
|
100
102
|
|
|
101
103
|
The coding style described in the :ref:`developer guidelines <linting>` should be
|
|
102
104
|
followed for all new code.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
|
|
2
|
+
flowchart TD
|
|
3
|
+
|
|
4
|
+
IN[("Input CF-NetCDF\nERA5 pressure + surface fields")]
|
|
5
|
+
|
|
6
|
+
subgraph PRE["preprocess()"]
|
|
7
|
+
direction TB
|
|
8
|
+
P0["Save _lats / _lons / _times\nfrom input coordinates"]
|
|
9
|
+
P1["5 pressure vars × 3 levels\n→ 15 channels"]
|
|
10
|
+
P2["Land/sea mask from\nmissing SST (first timestep)"]
|
|
11
|
+
P3["SST, gap-filled with\n2m temperature over land"]
|
|
12
|
+
P4["Stack → 17 channels\n(channel, time, lat, lon)"]
|
|
13
|
+
P6["_load_normalisation_stats()\nmean + range via h5py"]
|
|
14
|
+
P7["Normalise:\n(x - mean) / range"]
|
|
15
|
+
P0 --> P1
|
|
16
|
+
P0 --> P2
|
|
17
|
+
P0 --> P3
|
|
18
|
+
P1 --> P4
|
|
19
|
+
P2 --> P4
|
|
20
|
+
P3 --> P4
|
|
21
|
+
P4 --> P7
|
|
22
|
+
P6 --> P7
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
subgraph DET["detect() — one timestep at a time"]
|
|
26
|
+
direction TB
|
|
27
|
+
D1["Take frame t:\n(17, lat, lon)"]
|
|
28
|
+
D2["Run U-Net\n(no memory of other frames)"]
|
|
29
|
+
D3["Softmax → 5 class\nprobabilities per pixel"]
|
|
30
|
+
D4["Check output grid matches\ninput grid, else raise"]
|
|
31
|
+
D5[("Record every pixel\n→ _scores")]
|
|
32
|
+
D6["is_storm = winning class ≠ background\nAND prob ≥ threshold"]
|
|
33
|
+
D7["_cluster_candidates()\nflood-fill adjacent storm pixels\n(any class) → weighted centroids"]
|
|
34
|
+
D8["_merge_nearby_candidates()\ndrop weaker candidates within\nmerge_distance_deg (NMS)"]
|
|
35
|
+
D9["_colocated_variables()\nsample the 17 inputs at each\nlocation, de-normalised"]
|
|
36
|
+
|
|
37
|
+
D1 --> D2 --> D3 --> D4
|
|
38
|
+
D4 --> D5
|
|
39
|
+
D4 --> D6 --> D7 --> D8 --> D9
|
|
40
|
+
D9 -.next timestep.-> D1
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
CANDS[("_candidates\na list of TC locations,\neach with co-located variables")]
|
|
44
|
+
|
|
45
|
+
subgraph STITCH["stitch() — one timestep at a time, in strict order"]
|
|
46
|
+
direction TB
|
|
47
|
+
S0["Look up this timestep's\ncandidates"]
|
|
48
|
+
S1{{"PASS 1 - extend\nfor each ACTIVE track:\n_nearest_candidate() within\nmax_distance_deg?"}}
|
|
49
|
+
S2["Claim candidate, add point,\nreset missed = 0"]
|
|
50
|
+
S3["missed += 1"]
|
|
51
|
+
S4{{"PASS 2 - retire\nmissed > max_gap?"}}
|
|
52
|
+
S5[/"Close track:\nmove trail to finished"/]
|
|
53
|
+
S6["Stays in active_tracks"]
|
|
54
|
+
S7["PASS 3 - recruit\nany candidate left unclaimed\n→ new track, missed = 0"]
|
|
55
|
+
|
|
56
|
+
S0 --> S1
|
|
57
|
+
S1 -->|"match"| S2
|
|
58
|
+
S1 -->|"no match"| S3
|
|
59
|
+
S2 --> S4
|
|
60
|
+
S3 --> S4
|
|
61
|
+
S4 -->|"yes"| S5
|
|
62
|
+
S4 -->|"no"| S6
|
|
63
|
+
S6 --> S7
|
|
64
|
+
S7 -.next timestep.-> S0
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
FILTER["After the last timestep:\nany still-active tracks join finished,\nthen keep only those with\n≥ min_length observations\n→ stored on _trajectories"]
|
|
68
|
+
|
|
69
|
+
TRACKS[("list[Trajectory]\nalso via read_trajectories()")]
|
|
70
|
+
|
|
71
|
+
OUT_P["detections_to_netcdf()\noptional, called separately\nCF featureType = point\none record per detection"]
|
|
72
|
+
OUT_T["to_netcdf(output_file)\nCF featureType = trajectory\nragged array of tracks"]
|
|
73
|
+
|
|
74
|
+
RUN["run_tracker(output_file)\ncalls detect() → stitch() → to_netcdf()"]
|
|
75
|
+
|
|
76
|
+
RUN --> IN
|
|
77
|
+
IN --> PRE --> DET --> CANDS --> STITCH --> FILTER --> TRACKS
|
|
78
|
+
CANDS -.-> OUT_P
|
|
79
|
+
TRACKS --> OUT_T
|
|
80
|
+
|
|
81
|
+
style IN fill:#d5f5e3,stroke:#1e8449
|
|
82
|
+
style CANDS fill:#fef9e7,stroke:#f39c12
|
|
83
|
+
style TRACKS fill:#aed6f1,stroke:#1a5276
|
|
84
|
+
style PRE fill:#fdebd0,stroke:#e67e22
|
|
85
|
+
style DET fill:#eaf2f8,stroke:#2874a6
|
|
86
|
+
style STITCH fill:#eafaf1,stroke:#27ae60
|
|
87
|
+
style FILTER fill:#f4ecf7,stroke:#8e44ad
|
|
88
|
+
style OUT_P fill:#d6eaf8,stroke:#1a5276
|
|
89
|
+
style OUT_T fill:#d6eaf8,stroke:#1a5276
|
|
90
|
+
style RUN fill:#fadbd8,stroke:#943126
|
|
91
|
+
|