Skip to content

CM/PGM → PredictionFrame adapters #33

Description

@Polichinel

Epic: #31 · Depends on: #32

Background

Phase 1 added to_prediction_frame() for pgm data (views_postprocessing/unfao/frames.py, SpatialLevel.PGM, unit = priogrid_gid). Reconciliation also needs the cm side (SpatialLevel.CM, unit = country_id) and must return a reconciled pgm frame without mutating its input (de-mutation; views-reporting register C-184).

Work

  • Extend the frame adapters so cm prediction data → PredictionFrame at SpatialLevel.CM (unit = country_id), reusing the existing pgm path.
  • Keep the boundary thin (pandas→numpy only where the input is still a DataFrame); one concept per file.

Acceptance criteria

  • cm and pgm PredictionFrames build from the S0 fixture's inputs.
  • views_frames.conformance.assert_frame_contract passes for both.
  • Identifiers round-trip to (month_id, country_id) and (month_id, priogrid_gid).
  • Inputs are not mutated.

Validation

  • Unit tests alongside tests/test_views_frames_conformance.py.

Notes

  • Reuse views_postprocessing/unfao/frames.py:to_prediction_frame; the cm variant differs only in level/unit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    implementationCode implementation workreconciliationForecast reconciliation migration (views-reporting -> here)storyA single reviewable unit of an epic

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions