osmose.validation.ices¶
ICES Stock Assessment Graph (SAG) snapshot validator for OSMOSE outputs.
Reads frozen ICES SAG JSON snapshots (produced by _pull_ices_snapshots.py or fetched live via the ICES MCP server) and compares model run outputs against per-species SSB envelopes.
Snapshot layout (matches data/baltic/reference/ices_snapshots/):
<snapshot_dir>/
index.json # manifest: model_species_to_ices_stocks, units_by_stock
<stock>.assessment.json # list of {year, ssb, f, ...} dicts
<stock>.reference_points.json # {blim, bpa, fmsy, msy_btrigger, ...}
The validator:
Loads the snapshot manifest + per-stock assessments.
Computes the model’s mean spawning-stock biomass (the SSB output, which needs output.ssb.enabled) per species over a configurable window (e.g. last 5 years of the run). The biomass output is read alongside as context; quantity=”biomass” compares it instead (explicit opt-in).
Computes the ICES SSB envelope (min, max) over a configurable window of historical SAG data, summed across tonnes-unit stocks linked to the species.
Reports per-species: in-range (model_mean ∈ [ices_min, ices_max]), magnitude factor (model_mean / ices_geomean), excluded index-unit stocks (which can’t be summed with tonnes-unit stocks).
Index-unit stocks are excluded from the envelope sum because relative indices and tonnes can’t be combined. This matches the existing scripts/validate_baltic_vs_ices_sag.py convention.
Functions
|
Compare the model to ICES SSB envelopes per species. |
|
Per SMS prey species: biomass-weighted SMS M2 over |
|
Markdown lines for the SMS M2 comparison (appended by |
|
Format comparison results as a markdown report (plus the SMS M2 section when given). |
|
Load the SMS M2 snapshot described by |
|
Load an ICES SAG snapshot bundle from disk. |
|
Mean model biomass (biomass output, >= output.cutoff.age) over the trailing window. |
|
Annual tonnes of |
|
Window statistic ( |
|
Mean model spawning-stock biomass (SSB output, needs output.ssb.enabled) over the window. |
|
Per-year M2 aggregated over ages: Σ M2(a)·w(a) / Σ w(a) with w = BIO ( |
Classes
|
Loaded ICES SAG snapshot bundle for a model. |
|
Cod-attributed predation mortality on one prey over the model's trailing window. |
|
One prey stock: SMS cod-predation M2 beside the model's cod-attributed rate. |
|
Loaded WGSAM SMS M2 bundle (one key-run scenario, sentinel rows dropped). |
|
Result of comparing one species' model mean biomass to its ICES envelope. |