You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Country↔grid grouping core via cross_level_align #34
The heart of the migration. The original loops per (country, time, target), gathers that country's grid cells + the country total, calls the scaling math, and scatters the result back (views_reporting/.../dataset_export.pyto_reconciler / reconcile_pg_dataset). We do the same, frames-native and vectorised, on top of the slice-1 leaf reconcile_proportional (PR #30, views_postprocessing/reconciliation/proportional.py).
Work
Take a cm frame, a pgm frame, and an injected(time, priogrid_gid) → country_id mapping.
Use views_frames.cross_level_align to label each pgm row with its country; group by (time, country_id); for each group gather the cells + the matching country total, call reconcile_proportional, and scatter the result back into a new pgm frame.
Pure numpy + views-frames; avoid per-row Python loops where vectorisable.
Acceptance criteria
On the S0 fixture, per-country reconciled values reproduce the oracle within a tight, documented tolerance.
Zeros preserved, output non-negative, per-draw country sums hold (inherited from the leaf).
Returns a new pgm frame; input untouched.
Validation
Unit tests on the grouping/scatter against hand-computed small cases + S0-fixture slices.
Notes
cross_level_align requires a (time, unit)-keyed mapping. Our geography is time-invariant, so broadcast the static cell→country assignment over the frame's (time, unit) rows (or use cross_level_align_arrays at scale).
Activity
feat(reconciliation): cross_level_align grouping core, bit-exact pari…