Skip to content

[Global-PGM S2] Horizon-step rendering: +1/+6/+12/+24/+36 PNGs + hover heatmap at +1; explicit months (#232) - #252

Merged
Polichinel merged 3 commits into
developmentfrom
feat/global-pgm-s2-horizon-steps
Jul 21, 2026
Merged

[Global-PGM S2] Horizon-step rendering: +1/+6/+12/+24/+36 PNGs + hover heatmap at +1; explicit months (#232)#252
Polichinel merged 3 commits into
developmentfrom
feat/global-pgm-s2-horizon-steps

Conversation

@Polichinel

Copy link
Copy Markdown
Contributor

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

What

PGM forecast maps now render horizon steps — +1/+6/+12/+24/+36 months ahead (clamped to the horizon) as scale-flat PNGs, plus a hover-capable raster heatmap at step +1 — replacing the single silently-chosen times[-1] image. Month choice is explicit at the Compose boundary; the image renderer now refuses multi-month input (RED→GREEN in the commit history). CM is unchanged.

Why this shape

At global scale the full-horizon interactive animation is physics-bound (~7.2M lattice cell-frames ≈ 245 MB offline HTML), while one PNG is ~300 KB and a single global month (~202k cell-frames) fits the C-209 heatmap budget by construction. Decision recorded on #230 (Simon, 2026-07-20).

Measured (real rusty_bucket global ensemble: 3 targets × 36 months, S=128)

  • Report: 36.6 MB, 84 s — 15 step PNGs + 3 hover heatmaps.
  • Headings/dates verified: "Jul 2026 (step +1)" → "Jun 2029 (step +36)"; titles show "Jul 2026 — month_id 559" (no float-cast "594.0" anywhere).
  • The metadata warning fires for exactly the 322 declared unmatched forecast-region cells — matching the S1 stamp to the digit.

Changes

  • views_reporting/_time.py (new): month_id_to_label (epoch Jan 1980), shared by mapping titles and template headings.
  • templates/reports/forecast.py: step strategy replaces the size-escalation ladder for PGM; render-side budget guards stay injected; HORIZON_STEPS constant.
  • mapping/mapping.py: _plot_image_map renders exactly one month or raises (ADR-008); titles/alt-text carry the human date + integer month id.
  • Tests: Compose-boundary suite rewritten for the step pattern (6 tests); month-label unit tests; RED multi-month-refusal test.

Ritual

review-diff: 1 naming finding (misleading latest) — fixed. ship-it: ruff clean, 384 passed (2 skipped, 1 xfailed).

🤖 Generated with Claude Code

Polichinel and others added 3 commits July 21, 2026 02:28
Characterizes the silent times[-1] pick: _plot_image_map currently renders
only the LAST (furthest, most uncertain) month of a multi-month dataframe
with no signal. The fix moves month choice to the Compose boundary and makes
multi-month input here a loud error. This test fails at this commit by
design (RED); the next commit turns it green.

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

PGM forecast maps now render HORIZON STEPS (+1/+6/+12/+24/+36, clamped to
the horizon): one scale-flat PNG per step plus a hover-capable raster
heatmap at step +1 — month choice is explicit at the Compose boundary and
the image renderer REFUSES multi-month input (the RED test's silent
times[-1] pick is gone). CM keeps the whole-horizon choropleth unchanged.

New shared views_reporting/_time.py: month_id_to_label (epoch Jan 1980),
used by figure titles/alt-text ("Jul 2026 — month_id 559", never the
float-cast "594.0") and step headings.

The old size-escalation ladder in the template is replaced by the uniform
step strategy: at global scale the full-horizon animation is physics-bound
(~7.2M lattice cell-frames ≈ 245 MB) while one PNG is ~300 KB and one
global month fits the heatmap budget by construction. Render-side guards
(max_cells, max_raster_cell_frames) stay injected and armed.

Measured on the real rusty_bucket global ensemble (3 targets × 36 months,
S=128): report = 36.6 MB, 84 s — 15 step PNGs + 3 hover heatmaps, all
months/dates verified; the metadata warning shows exactly the 322 declared
unmatched forecast-region cells, matching the stamp to the digit.

384 tests green (Compose-boundary suite rewritten for the step pattern;
month-label unit tests added).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ied a pick that no longer exists (#232, review-diff A)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Polichinel
Polichinel merged commit e4355db into development Jul 21, 2026
1 check passed
@Polichinel
Polichinel deleted the feat/global-pgm-s2-horizon-steps branch July 21, 2026 00:57
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