Skip to content

[Global-PGM S3] Summary layers: MAP, P(any violence), HDI90/95 upper + probability colour scale (#233) - #253

Merged
Polichinel merged 2 commits into
developmentfrom
feat/global-pgm-s3-layers
Jul 21, 2026
Merged

[Global-PGM S3] Summary layers: MAP, P(any violence), HDI90/95 upper + probability colour scale (#233)#253
Polichinel merged 2 commits into
developmentfrom
feat/global-pgm-s3-layers

Conversation

@Polichinel

Copy link
Copy Markdown
Contributor

Closes #233. Part of epic #230 (tracker #237).

What

Sample forecasts now collapse into four map layers per PGM target — MAP (headline, hover heatmap at +1), P(any violence) (share of draws > 0), and the upper 90%/95% HDI bounds — each an S==1 frame through the same ADR-020 seam, each rendered at every horizon step. CM keeps MAP only (its line graph already carries HDI).

The motivating number (real rusty_bucket data, sb, step +1)

MAP shows 80 at-risk cells; P(any) shows 1,399 (163 at ≥50% probability). The probability layer surfaces the risk surface a zero-inflated posterior's mode structurally hides — this was the epic's founding question.

Colour correctness

New color_mode seam through plot_map → raster/PNG renderers: count layers keep the C-191 nonzero-anchored log scale; the probability layer gets a linear 0–1 scale (quarter ticks, probability-labelled bar). Unknown modes and unit-interval-on-choropleth fail loud (ADR-008).

Measured

Report = 45.8 MB, 201 s — 60 step PNGs (4 layers × 5 steps × 3 targets) + 3 hover heatmaps. Under the ~70 MB ceiling with room for S4's polish.

Changes

  • statistics/dataset_statistics.py: calculate_exceedance_frame (NaN policy mirrors the MAP collapse; strict >, threshold parameterized); exported.
  • templates/reports/forecast.py: layer list construction + layers × steps render loop; heatmap only for the headline layer at +1.
  • mapping/mapping.py: color_mode on plot_map/raster/PNG; _unit_interval_scale; probability colourbar titles; boundary validation.
  • Tests (12 new): exceedance value/NaN/threshold laws + the P(any) ⊇ MAP coverage law; 4-layer plumbing on a real sample frame; colour-mode dispatch on both renderers; CM stays MAP-only.

Ritual

review-diff: one docstring finding, fixed. ship-it: ruff clean, 396 passed (2 skipped, 1 xfailed).

🤖 Generated with Claude Code

Polichinel and others added 2 commits July 21, 2026 03:11
…#233)

Sample forecasts now collapse into FOUR map layers per PGM target, each an
S==1 frame through the same ADR-020 seam: MAP (headline, hover heatmap at
step +1), P(any violence) = share of draws > 0, and the upper 90%/95% HDI
bounds. CM keeps MAP only (its line graph already carries HDI).

New calculate_exceedance_frame in the statistics tower (NaN policy mirrors
the MAP collapse; threshold parameterized, strict >). New colour-mode seam
through plot_map → raster/PNG renderers: count layers keep the C-191
nonzero-anchored log scale; the probability layer gets a linear 0-1 scale
with quarter ticks and a probability-labelled bar — validated at the
plot_map boundary, and unit_interval on the choropleth path fails loud.

Measured on the real rusty_bucket global ensemble: report = 45.8 MB, 201 s
— 60 step PNGs (4 layers x 5 steps x 3 targets) + 3 hover heatmaps. The
motivating number: at step +1, P(any) shows 1,399 at-risk cells where MAP
shows 80 (163 cells at >=50%) — the layer surfaces the risk a zero-inflated
posterior's mode structurally hides.

396 tests green (12 new: exceedance laws incl. the P(any)-superset-of-MAP
coverage law, layer plumbing on a real sample frame, colour-mode dispatch
on both renderers).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…f B)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Polichinel
Polichinel merged commit db146cb into development Jul 21, 2026
1 check passed
@Polichinel
Polichinel deleted the feat/global-pgm-s3-layers branch July 21, 2026 01:39
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.

1 participant