How oceanmodeling/ondemand-storm-workflow works
1. What this repository is
- stormworkflow is a Python workflow for generating probabilistic storm-surge products from an ensemble of tropical cyclone simulations.
- The repo is organized as a pipeline: prepare inputs → run simulations on HPC → postprocess ensemble outputs → validate/visualize results.
2. Top-level orchestration
- stormworkflow/main.py is the likely Python entrypoint that ties the workflow together.
- The package layout suggests the workflow is driven by configuration and then dispatches into prep or postprocessing steps rather than embedding the solver itself in Python.
3. Preprocessing subsystem
- stormworkflow/prep/ contains the input-building side of the workflow.
- Key responsibilities appear to be:
- fetching external datasets (download_data.py)
- assembling hurricane forcing and event metadata (hurricane_data.py)
- generating or adapting the computational mesh (hurricane_mesh.py)
- defining ensemble members / parameter perturbations (setup_ensemble.py)
- generating model-ready directories and input files (setup_model.py)
- optional wave-model setup (wwm.py)
- This is the stage where raw scientific data becomes solver-ready inputs.
4. Simulation/model boundary
- The presence of stormworkflow/refs/param.nml, input.yaml, and wwminput.nml indicates the workflow emits Fortran-style namelist and YAML configuration files consumed by downstream model components.
- The stormworkflow/slurm/ directory and schism.sbatch strongly imply the actual storm-surge solver runs externally on a SLURM-managed HPC cluster, likely using SCHISM or a closely related coastal model.
- Python prepares the run; HPC scripts execute the heavy numerical model.
5. Batch and operational scripts
- stormworkflow/scripts/ contains shell helpers that likely glue together the workflow stages:
- entrypoint.sh
- workflow.sh
- combine_gr3.exp
- These scripts are the operational boundary between Python orchestration and cluster execution, and are likely used in containers or job-launch contexts.
6. SLURM job definitions
- stormworkflow/slurm/prep.sbatch, mesh.sbatch, post.sbatch, and schism.sbatch indicate the workflow is split into separate compute jobs.
- This separation suggests a distributed execution model:
- prep/mesh generation jobs
- model simulation jobs
- postprocessing jobs
- That boundary is important for architecture diagrams because compute-heavy steps do not run in the same process as the Python controller.
7. Postprocessing subsystem
- stormworkflow/post/ handles aggregation and analysis of simulation outputs.
- The modules indicate several distinct postprocessing products:
- ensemble combination (combine_ensemble.py)
- ensemble statistics/analysis (analyze_ensemble.py)
- visualization generation (generate_viz.py)
- surge/hurricane-specific diagnostics (hurricane_funcs.py)
- maximum elevation and difference analyses (max_ele_vs_hwm.py, maxelev_diff.py)
- validation against tides/observations (Tidal_validation.py)
- storm return/relative curve analysis (storm_roc_ts_rel_curves.py)
- This stage converts raw per-member model output into probabilistic and validation-oriented deliverables.
8. Reference assets and templates
- stormworkflow/refs/ stores canonical input templates and model defaults.
- These reference files are important because they define the baseline configuration used to generate a reproducible simulation set.
- The workflow likely copies or parameterizes these templates during setup.
9. Versioned inputs and backward compatibility
- tests/data/refs/input_v0.0.1.yaml through input_v0.0.5.yaml plus leadtime.json show that the input schema has evolved over time.
- tests/test_input_version.py suggests the repo actively checks compatibility across input versions, which is an important architectural concern for a workflow intended to be reused across events and releases.
10. Testing and validation
- tests/test_prep_funcs.py focuses on preprocessing logic, meaning the repository emphasizes correctness in input generation.
- tests/test.sh and tests/conftest.py suggest integration-style test execution in addition to unit tests.
- The tests/data/refs/ fixtures provide known-good configuration files for regression testing.
11. Runtime and packaging
- pyproject.toml and environment.yml indicate standard Python packaging plus a Conda-based scientific runtime.
- This is a scientific workflow repository rather than a general web service: the important runtime concerns are package reproducibility, numerical dependencies, and HPC execution compatibility.
12. Likely end-to-end data flow
- External hurricane/ocean inputs are acquired or staged in prep/.
- Mesh and model configuration are generated.
- Ensemble members are launched through SLURM and an external surge model.
- Model outputs are collected by post/ modules into probabilistic summaries, validation metrics, and plots.
13. Key architectural boundary
- The most important boundary is between workflow control in Python and numerical simulation in external HPC jobs.
- Another important boundary is between event-specific inputs/configuration and generic reusable postprocessing/validation code.
14. What to draw in an architecture diagram
- Show a Python orchestrator at the center.
- Feed it with reference templates and external hurricane datasets.
- From it, branch to preprocessing, then to SLURM-managed simulation jobs, then to postprocessing/visualization/validation.
- Include tests and versioned input fixtures as a separate quality-control lane.
Main entry points: analyze_ensemble.py Analyze ensemble · setup_model.py Model setup · workflow.sh Workflow script · tests Tests
Components 23
Orchestration
Python entrypoints and shell glue that coordinate the workflow
- Workflow main · Top-level workflow driver
stormworkflow/main.py - Entrypoint · Container or job entry wrapper
stormworkflow/scripts/entrypoint.sh - Workflow script · Shell logic that ties stages together
stormworkflow/scripts/workflow.sh - Reference templates · Canonical input and namelist templates
stormworkflow/refs/input.yaml
Preprocessing
Data acquisition, event setup, mesh generation, and model staging
- Fetch data · Download or stage external forcing data
stormworkflow/prep/download_data.py - Storm data · Hurricane event and forcing assembly
stormworkflow/prep/hurricane_data.py - Mesh setup · Generate or adapt computational mesh
stormworkflow/prep/hurricane_mesh.py - Ensemble setup · Define perturbations and ensemble members
stormworkflow/prep/setup_ensemble.py - Model setup · Create run directories and model-ready inputs
stormworkflow/prep/setup_model.py - Wave setup · Optional wave-model configuration
stormworkflow/prep/wwm.py
HPC Run
SLURM jobs and external solver execution
- Prep job · Batch job for preprocessing stages
stormworkflow/slurm/prep.sbatch - Mesh job · Batch job for mesh generation or adaptation
stormworkflow/slurm/mesh.sbatch - Solver job · Batch job that launches the external storm-surge model
stormworkflow/slurm/schism.sbatch - Post job · Batch job for output aggregation and analysis
stormworkflow/slurm/post.sbatch
Postprocessing
Ensemble aggregation, diagnostics, validation, and plots
- Combine ensemble · Merge member outputs into ensemble products
stormworkflow/post/combine_ensemble.py - Analyze ensemble · Compute ensemble summaries and diagnostics
stormworkflow/post/analyze_ensemble.py - Generate plots · Produce visualizations and figures
stormworkflow/post/generate_viz.py - Validate tides · Compare model output against tide or observation data
stormworkflow/post/Tidal_validation.py - HWM compare · Analyze max elevation versus high-water marks
stormworkflow/post/max_ele_vs_hwm.py - Elevation diff · Compute maximum elevation differences
stormworkflow/post/maxelev_diff.py - Return curves · Storm return and relative curve analysis
stormworkflow/post/storm_roc_ts_rel_curves.py
Quality Control
Tests and versioned fixtures that guard input compatibility
- Tests · Unit and integration checks for workflow logic
tests - Versioned inputs · Back-compat input samples and lead-time fixture
tests/data/refs
Connections 26
- Workflow main → Workflow script: delegates · Python entrypoint hands off orchestration to shell workflow
- Entrypoint → Workflow main: starts · Entry wrapper launches the Python controller
- Workflow script → Prep job: submits · Workflow dispatches preprocessing batch jobs
- Workflow script → Mesh job: submits · Workflow dispatches mesh generation jobs
- Workflow script → Solver job: submits · Workflow dispatches solver runs on SLURM
- Workflow script → Post job: submits · Workflow dispatches postprocessing jobs
- Reference templates → Fetch data: templates · Reference configuration seeds preprocessing
- Reference templates → Model setup: defaults · Canonical model inputs are parameterized into run files
- Fetch data → Storm data: feeds · Fetched datasets become event-specific forcing
- Storm data → Mesh setup: drives · Storm metadata informs mesh and domain setup
- Storm data → Ensemble setup: drives · Event metadata defines ensemble construction
- Mesh setup → Model setup: produces · Mesh artifacts are staged into model inputs
- Ensemble setup → Model setup: parameterizes · Ensemble members are written into model-ready runs
- Wave setup → Model setup: couples · Optional wave-model inputs are added to run configuration
- Model setup → Solver job: executes · Prepared inputs are consumed by the external solver
- Solver job → Combine ensemble: outputs · Solver outputs are collected for ensemble merging
- Combine ensemble → Analyze ensemble: feeds · Combined outputs are summarized and analyzed
- Analyze ensemble → Generate plots: renders · Analysis results become plots and deliverables
- Analyze ensemble → Validate tides: checks · Ensemble statistics are compared against observations
- Analyze ensemble → HWM compare: checks · Maximum surge/elevation is compared to high-water marks
- Analyze ensemble → Elevation diff: derives · Difference diagnostics are computed from ensemble output
- Analyze ensemble → Return curves: derives · Return-curve analysis is generated from postprocessed fields
- Tests → Versioned inputs: uses · Tests rely on versioned input fixtures
- Tests → Workflow main: covers · Test suite exercises workflow orchestration
- Tests → Fetch data: covers · Test suite exercises preprocessing behavior
- Tests → Model setup: covers · Test suite checks model input generation