Skip to content

Restructure the SWAN notebooks into a tutorial and examples - #4

Merged
tomdurrant merged 8 commits into
wp5-1from
swan-restructure
Sep 28, 2026
Merged

tomdurrant merged 8 commits into
wp5-1from
swan-restructure

Conversation

@rafa-guedes

@rafa-guedes rafa-guedes commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

This PR replaces the SWAN notebooks with a new collection in the tutorial/examples layout of the XBeach notebooks, as agreed.

Builds on #3, now merged into wp5-1. The branch includes the latest wp5-1, with the hook import fix.

The collection

All notebooks model the coast off Perth on 1 January 2023, with ETOPO 2022 bathymetry, ERA5 winds and WAVEWATCH III boundary spectra. Every notebook that needs it runs SWAN, and the results are committed.

  • notebooks/swan/tutorial/, 7 ordered lessons:

    1. a first stationary model;
    2. the grid and spectrum;
    3. input grids and SWAN's modes;
    4. wave boundaries;
    5. model settings and SWAN's defaults;
    6. a nonstationary hindcast, with checks and analysis;
    7. YAML and the rompy CLI, including rompy run.
  • notebooks/swan/examples/, 12 focused notebooks:

    • grid types, input grids;
    • parametric boundaries, boundaries from spectra, nesting (a parent run feeding a child);
    • physics, numerics, output;
    • stationary vs nonstationary computations, hotstart and chained runs;
    • running SWAN (local, Docker, MPI), physics sensitivity.
  • notebooks/swan/data/, 2 MB committed:

    • an ETOPO 15″ bathymetry subset from NOAA's ERDDAP server;
    • the ERA5 and WW3 files shared with the XBeach notebooks;
    • an intake catalogue.

    It is listed in data/example-data.json.

  • notebooks/swan/README.md is the index, including a table of where each previous notebook's content went.

The notebooks explain the SWAN concepts they use (computational vs input grids, spectral resolution, conventions, defaults, time steps, how to check PRINT) and link to the SWAN 41.51 manual. The model-agnostic value of rompy is covered by docs/why-rompy.md and common/rompy_hands_on.ipynb from #3, so the notebooks don't repeat it.

Removed

The previous SWAN notebooks and their YAML files: tutorial_01–07, example_*, boundary/* and components/output. Their content is covered as listed in the README.

Site and tooling

  • Metadata: rompy_notebooks metadata on every notebook, the same convention as XBeach.
  • Audit: the SWAN checks use the lesson template and the new paths, and every example is checked, as for XBeach.
  • Docs pages: swan-tutorial.md, models/swan.md, the gallery, the coverage matrix and the concept-page links are updated. The conventions page now lists XBeach and SWAN on the shared layout.
  • requirements.txt installs rompy-swan from main, because the notebooks need the fixes in Fix stationary runs, boundary spreading and several rendering bugs rompy-swan#20. Change it to a release once one is published.

Dependencies in rompy-swan

Checks

  • All 19 notebooks executed end to end from a clean kernel, against rompy main and rompy-swan with #20, running SWAN with the locally built image of #21.
  • make docs-build (audit and mkdocs build --strict) passes with no warnings. pytest tests passes.
  • Crawled every internal link on the built site.

ETOPO 2022 bathymetry off Perth at 15 arc-seconds (NOAA ERDDAP), and the
ERA5 winds and WAVEWATCH III spectra shared with the XBeach notebooks,
with an intake catalogue and a README.
Seven lessons from a first stationary model to a nonstationary hindcast
and its YAML configuration, all off Perth, running SWAN in the
ghcr.io/rom-py/swan image.
Twelve focused notebooks: grid types, input grids, parametric and
spectral boundaries, nesting, physics, numerics, output, stationary and
nonstationary computations, hotstarts, running SWAN and physics
sensitivity.
The README maps each previous notebook to where its content now lives.
- Rewrite the SWAN learning tutorial page, overview and gallery section,
  and update the coverage matrix, concept-page links and conventions.
- List the SWAN data in data/example-data.json.
- Install rompy-swan from main, which has the fixes the notebooks need.
- Point the hands-on notebook to the new SWAN tutorial.
@rafa-guedes
rafa-guedes changed the base branch from wp5-1-xbeach to wp5-1 September 28, 2026 15:39
rompy-swan now defines the single computation of stationary mode as
COMPUTE, and rejects COMPUTE_STAT in that mode instead of rewriting it
(rom-py/rompy-swan#20). Tutorial 1 and Running SWAN use it, and the
stationary and nonstationary example shows it with the check in both
directions. Tutorial 3 is re-run for the new error message.
@tomdurrant
tomdurrant merged commit aa08bf4 into wp5-1 Sep 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants