Skip to content

Commit 003d7a2

Browse files
mariusaurusdallasfosterNickGeneva
authored
TC hunt vol. 4 (#871)
* resolved conflict * update changelog * move seed initialization and fix dxwrapper tests * tempest extremes diagnostic model * error message * testing if TE is available and works * started working on support for batch sizes >1, currently works for bs 1 * halfway to larger batch support * enabling TE for batch sizes of >1. async version seems to work as well but needs further testing with batching. * option to pass file names to TE connector * array equal test * first stable try * support for per-member parallel execution and lets user controll max num workers * precommit hooks * vibe-coded some tests, need to be hand-tested and selected * vibe-coded some tests, need to be hand-tested and selected * passing all pre-commit tests, still need to sub-select tests as there are too many right now * subselected tests * install doc * throwing an error in case cleanup is not called before object goes out of scope * custom depenmdency failure message for TE * moved tensor tiling and concatenation to utils * enable setting fcn3 random seed * add proper noise handling for fcn3 * fix linting and test issues * update lockfile * move seed initialization and fix dxwrapper tests * tc tracking pipeline * update * updated uv.lock * seems to work now * wind gust from HRRR analysis * minor updates * stability test * version check for torch-harmonics import * addressed greptile comments * time import * comma * updated env * moved tempest_extremes * wip * exploring aifs ensemble capability * thread issue with writing to netcdf in threads * automated testing of writing TE files and their reproducibility. bug fix for mk race condition * README for tc_hunt test * second test for extracting historic data * added aux data for tests * test for reference track extraction * wip * track plotting notebook * field and track notebook * plotting tracks and fields notebook * case study notebook * REAMEs and markdowns in notebooks * drafted readme * first iteration over readme * final touches README * ...gif * wip * verified plotting for west-pacific * final touches * removed some configs * pyproject project name * README comment about conainer build time * removed TE from models/dx/__init__ * moving a bracket around * updated base container * fixed some bugs to be in line with new main * split plan * first round of LLM reduction * doc strings and type hints for generate_ensembles.py * doc strings and type hints for tempest_extremes.py * doc strings and type hints for src/utils.py * doc strings and type hints for data * orography from HF * git lfs in dockerfile * final touches * final touches * reverted fcn3 changes * updated dockerfile to latest physics nemo container and reduced number of additional layers * first round of pre-commit hooks * licenses * renamed some files and removed tempest_extremes testing * TE list files unique by time stamp * Te timeouts * improved catching of TE failures * satisfying the greptile * TE workers * collecting all tasks in wait_for_completion and in cleanup * re-using wait for compeltion and cosmetics * removed some stale code, replaced use_ram with shm location, some cleanups * replace TempestExtremes module-level globals with singleton and flatten nested thread pools * removed SFNO support, replaced print statements with loggers. * refactored pyproject.toml * updated install notes * added reproducibility * store overwrite * pt 3 init * updated install docs * setuptools version * optional AIFS/FCN3 deps * data sources in config * greptile feedback * plotting * updated jupyter cells * claude review * removed some dead code * Some renames / organization to match other recipes * Some renames / organization to match other recipes --------- Co-authored-by: Dallas Foster <dallasf@nvidia.com> Co-authored-by: MarsuPila <22983240+MarsuPila@users.noreply.github.com> Co-authored-by: Nicholas Geneva <5533524+NickGeneva@users.noreply.github.com> Co-authored-by: Nicholas Geneva <ngeneva@nvidia.com>
1 parent 35c1707 commit 003d7a2

11 files changed

Lines changed: 2509 additions & 55 deletions

recipes/tc_tracking/README.md

Lines changed: 27 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,12 @@ process.
4343
- [2.1 Generate Ensemble](#21-generate-ensemble)
4444
- [2.2 Reproduce Individual Ensemble Members](#22-reproduce-individual-ensemble-members)
4545
- [2.3 Extract Reference Tracks from ERA5](#23-extract-reference-tracks-from-era5)
46-
3. [Visualisation](#3-visualisation) *(coming soon)*
46+
3. [Visualisation](#3-visualisation)
4747
4. [TempestExtremes Integration](#4-tempestextremes-integration)
4848
5. [Example Workflow](#5-example-workflow)
4949
- [5.1 Extract Baseline](#51-extract-baseline-optional)
5050
- [5.2 Produce Ensemble Forecasts](#52-produce-ensemble-forecasts)
5151
- [5.3 Analyse Tracks](#53-analyse-tracks)
52-
*(coming soon)*
5352
- [5.4 Reproduce Interesting Members](#54-reproduce-interesting-members-to-extract-fields)
5453

5554
## 1. Setting up the Environment
@@ -139,7 +138,7 @@ Runs are configured through YAML files located in
139138
`tc_tracking/cfg`. To execute the pipeline:
140139

141140
```bash
142-
python tc_hunt.py --config-name=config.yaml
141+
python main.py --config-name=config.yaml
143142
```
144143

145144
The pipeline has three operational modes:
@@ -162,7 +161,7 @@ The two GPU-bound modes (`generate_ensemble` and
162161
settings using Slurm, MPI, or torchrun, e.g.
163162

164163
```bash
165-
torchrun --nproc-per-node=2 tc_hunt.py --config-name=config.yaml
164+
torchrun --nproc-per-node=2 main.py --config-name=config.yaml
166165
```
167166

168167
The pipeline has three operational modes:
@@ -182,7 +181,7 @@ The pipeline has three operational modes:
182181
storms are distributed across CPU worker processes via the
183182
``num_workers`` configuration entry (see
184183
[Section 2.3](#23-extract-reference-tracks-from-era5)),
185-
so a plain ``python tc_hunt.py ...`` invocation suffices.
184+
so a plain ``python main.py ...`` invocation suffices.
186185

187186
In the following we will explain how to configure the yaml
188187
files for those three modes. You can find example configs
@@ -570,29 +569,33 @@ and a warning is logged.
570569

571570
## 3. Visualisation
572571

573-
> [!Note]
574-
> Visualisation tools will be available in a future update.
575-
576-
<!-- markdownlint-disable MD033 -->
577-
<details>
578-
<summary>Preview</summary>
579-
580-
Two Jupyter notebooks are provided in `./plotting` for
581-
analysing and visualising tropical cyclone tracking results:
572+
Two [JupyText](https://jupytext.readthedocs.io/) notebook scripts are
573+
provided in the recipe root for analysing and visualising tropical cyclone
574+
tracking results:
582575

583-
- **`tracks_slayground.ipynb`**: Ensemble track analysis
576+
- **`plot_tracks_analysis.py`**: Ensemble track analysis
584577
including spaghetti plots (trajectory visualisation),
585578
absolute and relative intensity metrics (wind speed,
586579
MSLP), comparisons against ERA5 reference tracks and
587580
IBTrACS observations, extreme value statistics, and
588581
error moment analysis over lead time.
589582

590-
- **`plot_tracks_n_fields.ipynb`**: Create animated
583+
- **`plot_tracks_n_fields.py`**: Create animated
591584
visualisations of storm tracks overlaid on atmospheric
592585
field data.
593586

594-
</details>
595-
<!-- markdownlint-enable MD033 -->
587+
Both scripts can be run as plain Python files or converted to Jupyter
588+
notebooks via JupyText. From the recipe root:
589+
590+
```bash
591+
jupytext --to notebook plot_tracks_analysis.py
592+
jupytext --to notebook plot_tracks_n_fields.py
593+
jupyter notebook plot_tracks_analysis.ipynb
594+
```
595+
596+
The recipe root must be the working directory so that `src.plt.*` imports
597+
resolve correctly. Helper modules (`analyse_n_plot.py`, `data_handling.py`,
598+
`plotting_helpers.py`) live in `src/plt/`.
596599

597600
## 4. TempestExtremes Integration
598601

@@ -682,7 +685,7 @@ needed; storms are spread across `num_workers` CPU worker
682685
processes as configured in the YAML):
683686

684687
```bash
685-
python tc_hunt.py --config-name=extract_era5.yaml
688+
python main.py --config-name=extract_era5.yaml
686689
```
687690

688691
This should produce a folder called
@@ -698,8 +701,8 @@ Run the forecast loop for Helene using FCN3 and for Hato
698701
using AIFS-ENS:
699702

700703
```bash
701-
python tc_hunt.py --config-name=helene.yaml
702-
python tc_hunt.py --config-name=hato.yaml
704+
python main.py --config-name=helene.yaml
705+
python main.py --config-name=hato.yaml
703706
```
704707

705708
This should produce two output folders: `outputs_helene` and
@@ -708,15 +711,8 @@ trajectories.
708711

709712
### 5.3 Analyse Tracks
710713

711-
> [!Note]
712-
> Visualisation tools will be available in a future update.
713-
714-
<!-- markdownlint-disable MD033 -->
715-
<details>
716-
<summary>Preview</summary>
717-
718714
Visualise the results using the notebook
719-
`plotting/tracks_slayground.ipynb`.
715+
`plot_tracks_analysis.py` (or convert to `.ipynb` via jupytext).
720716

721717
**For Helene**, configure the first cell of the notebook
722718
with:
@@ -739,9 +735,6 @@ tru_track_dir = '/path/to/outputs_reference_tracks'
739735
# tru_track_dir = '/path/to/test/aux_data'
740736
```
741737

742-
</details>
743-
<!-- markdownlint-enable MD033 -->
744-
745738
### 5.4 Reproduce Interesting Members to Extract Fields
746739

747740
Suppose that after conducting the above analysis you want
@@ -762,7 +755,7 @@ atmospheric fields for detailed analysis.
762755
3. Execute the pipeline:
763756

764757
```bash
765-
python tc_hunt.py --config-name=reproduce_helene.yaml
758+
python main.py --config-name=reproduce_helene.yaml
766759
```
767760

768761
4. This should produce a folder `outputs_reproduce_helene`
@@ -772,7 +765,7 @@ atmospheric fields for detailed analysis.
772765

773766
**Visualise Tracks and Fields**:
774767

775-
Use the notebook `plotting/plot_tracks_n_fields.ipynb` to
768+
Use the notebook `plot_tracks_n_fields.py` to
776769
create animated visualisations:
777770

778771
1. Configure the file paths:

0 commit comments

Comments
 (0)