How noaa-ocs-modeling/ensembleperturbation works
1. What this repository is
- ensembleperturbation is a Python library for generating ensembles by perturbing storm/coupled-model inputs, then parsing and comparing the resulting model outputs.
- The core workflow is file-oriented: ingest track/advisory data, generate perturbed ensemble members, run external models, then combine/visualize the outputs.
2. Top-level package boundaries
- ensembleperturbation/client contains the CLI-facing entry points and orchestration scripts.
- ensembleperturbation/perturbation contains track/advisory perturbation logic.
- ensembleperturbation/parsing contains readers and comparators for model outputs.
- ensembleperturbation/uncertainty_quantification contains ensemble math and surrogate/UQ methods.
- ensembleperturbation/plotting contains geospatial and diagnostic visualization code.
- ensembleperturbation/utilities.py and the */utilities.py modules hold shared helpers used across these layers.
3. Primary command-line workflow
- The package exposes four CLI commands: make_storm_ensemble, perturb_tracks, combine_results, and plot_results.
- These map to the main lifecycle: create an ensemble, perturb input tracks, merge simulation outputs, and generate plots.
4. Perturbation subsystem
- perturbation/atcf.py is the storm-track perturbation engine, likely centered on ATCF-style advisory/track files.
- The tests and fixtures show support for both “original” tracks and multiple perturbed .22 files plus companion JSON metadata.
- This subsystem is the boundary between storm forecast data and the ensemble generation stage.
5. Model-output parsing subsystem
- parsing/adcirc.py and parsing/schism.py indicate support for at least two coastal/ocean simulation models.
- The inputs in tests include common model artifacts such as fort.14, fort.15, fort.16, fort.33, fort.63.nc, fort.64.nc, fort.67.nc, fort.68.nc, maxele.63.nc, and maxvel.63.nc.
- parsing/comparison.py and parsing/utilities.py provide the glue to compare perturbed runs against a reference or across ensemble members.
6. Ensemble and uncertainty-quantification layer
- uncertainty_quantification/ensemble_array.py represents ensemble data in array form.
- karhunen_loeve_expansion.py and polynomial_chaos.py show that the library supports reduced-order stochastic modeling, not just brute-force perturbations.
- surrogate.py suggests the package can build approximate models from ensemble results, which is important for downstream analysis and extrapolation.
7. Plotting and diagnostics
- plotting/map.py, geometry.py, nodes.py, and gdal_dataset.py suggest geospatial plotting over meshes, rasters, or other spatial datasets.
- plotting/perturbation.py, surrogate.py, and taylor_diagram.py indicate the library can visualize both ensemble perturbations and statistical skill/comparison metrics.
- Plotting is a downstream consumer of parsed outputs and UQ results, not the source of truth.
8. Data flow through the system
- Storm/advisory input enters the perturbation layer.
- Perturbation produces a set of alternate track files and metadata.
- External model runs generate ADCIRC/SCHISM output files for each ensemble member.
- Parsing converts those outputs into comparable structures.
- UQ and comparison modules aggregate, analyze, and score the ensemble.
- Plotting turns the analyzed results into maps and diagnostics.
9. Repository evidence of supported scenarios
- The tests reference multiple ensemble modes: best-track, forecast-track, advisory-based, monovariate and multivariate perturbations, and cases with/without isotach adjustment.
- This implies the architecture is designed around configurable perturbation strategies rather than one fixed ensemble method.
10. Examples and fixtures as architectural documentation
- The examples/ directory demonstrates end-to-end usage for parsing stations, comparing zeta and uv against references, and running Karhunen-Loève/polynomial-chaos workflows.
- The large tests/data tree acts like a contract for file formats and expected outputs, showing that interoperability with model-generated files is central to the design.
11. Operational/tooling boundary
- The project is packaged with pyproject.toml, documented with Sphinx, and exercised by GitHub Actions workflows.
- That tooling does not drive the runtime architecture, but it does reinforce that the package is meant to be used as a reusable Python library with CLI entry points and reproducible file-based workflows.
Main entry points: comparison.py Comparison · atcf.py ATCF perturbation · plot_results.py Plot results · ensemble_array.py Ensemble array
Components 22
Client
Command-line entry points and run orchestration.
- Make ensemble · Creates storm ensemble inputs and coordinates generation steps.
ensembleperturbation/client/make_storm_ensemble.py - Perturb tracks · Runs track/advisory perturbation workflows from the command line.
ensembleperturbation/client/perturb_tracks.py - Combine results · Merges model outputs across ensemble members.
ensembleperturbation/client/combine_results.py - Plot results · Produces plots and diagnostics from parsed ensemble outputs.
ensembleperturbation/client/plot_results.py
Perturbation
Storm/advisory track perturbation and ensemble member generation.
- ATCF perturbation · Generates perturbed storm tracks and advisory variants from ATCF-style inputs.
ensembleperturbation/perturbation/atcf.py - Perturb helpers · Shared perturbation-layer utilities.
ensembleperturbation/perturbation/__init__.py
Parsing
Model-output readers and comparison glue.
- ADCIRC parser · Reads ADCIRC outputs and related run artifacts.
ensembleperturbation/parsing/adcirc.py - SCHISM parser · Reads SCHISM outputs and related run artifacts.
ensembleperturbation/parsing/schism.py - Comparison · Aligns reference and ensemble outputs for scoring and analysis.
ensembleperturbation/parsing/comparison.py - Parse helpers · Utilities shared by parsing and comparison code.
ensembleperturbation/parsing/utilities.py
Uncertainty quantification
Ensemble representations and reduced-order stochastic methods.
- Ensemble array · Array-based representation of ensemble results.
ensembleperturbation/uncertainty_quantification/ensemble_array.py - KL expansion · Karhunen-Loève basis construction for reduced-order ensemble structure.
ensembleperturbation/uncertainty_quantification/karhunen_loeve_expansion.py - Polynomial chaos · Polynomial-chaos uncertainty quantification and approximation.
ensembleperturbation/uncertainty_quantification/polynomial_chaos.py - Surrogate model · Builds approximate models from ensemble/UQ results.
ensembleperturbation/uncertainty_quantification/surrogate.py
Plotting
Geospatial and diagnostic visualization of outputs and analyses.
- Map plots · Maps mesh, raster, and geospatial outputs.
ensembleperturbation/plotting/map.py - Geometry plots · Geometry and mesh-aware plotting utilities.
ensembleperturbation/plotting/geometry.py - Node plots · Node-centered plotting and field rendering.
ensembleperturbation/plotting/nodes.py - Perturbation plots · Visualizes perturbation ensembles and their spread.
ensembleperturbation/plotting/perturbation.py - Surrogate plots · Visualizes surrogate-model behavior and fit.
ensembleperturbation/plotting/surrogate.py - Taylor diagram · Displays comparative skill and statistical agreement metrics.
ensembleperturbation/plotting/taylor_diagram.py - Plot helpers · Shared plotting utilities and adapters.
ensembleperturbation/plotting/utilities.py
Shared
Cross-cutting helpers used across the library.
- Shared utils · Repository-wide helpers used by multiple layers.
ensembleperturbation/utilities.py
Connections 24
- Make ensemble → ATCF perturbation: builds · CLI coordinates track/advisory perturbation to create ensembles.
- Perturb tracks → ATCF perturbation: drives · Command-line workflow for perturbing storm tracks.
- Combine results → Comparison: combines · Merges and compares outputs across ensemble members.
- Plot results → Map plots: renders · CLI entry point for generating plots from analysis results.
- ATCF perturbation → Shared utils: uses · Track perturbation relies on shared helpers.
- ATCF perturbation → Perturb helpers: uses · Perturbation-specific helper support.
- ADCIRC parser → Comparison: feeds · Parsed ADCIRC outputs are compared against references or peers.
- SCHISM parser → Comparison: feeds · Parsed SCHISM outputs are compared against references or peers.
- Comparison → Parse helpers: uses · Comparison logic shares parsing helpers.
- Comparison → Ensemble array: aggregates · Comparison and scoring operate on ensemble-shaped data.
- Ensemble array → KL expansion: supports · Array representation underpins reduced-order decomposition.
- Ensemble array → Polynomial chaos: supports · Array representation supports stochastic surrogate workflows.
- KL expansion → Surrogate model: builds · KL bases can feed surrogate modeling.
- Polynomial chaos → Surrogate model: builds · Polynomial-chaos results can feed surrogate modeling.
- Surrogate model → Surrogate plots: visualized by · Surrogate analysis is rendered in dedicated plots.
- Map plots → Geometry plots: uses · Map rendering depends on geometry/mesh helpers.
- Map plots → Node plots: uses · Spatial plots can be node-centered.
- Perturbation plots → ATCF perturbation: shows · Perturbation diagnostics visualize generated ensemble members.
- Taylor diagram → Comparison: shows · Taylor diagrams summarize comparison metrics.
- Plot results → Perturbation plots: renders · Plot CLI can generate perturbation diagnostics.
- Plot results → Surrogate plots: renders · Plot CLI can generate surrogate diagnostics.
- Plot results → Taylor diagram: renders · Plot CLI can generate skill-comparison diagrams.
- Shared utils → Parse helpers: shared by · Repository-wide helpers are reused by parsing logic.
- Shared utils → Plot helpers: shared by · Repository-wide helpers are reused by plotting logic.