Skip to content

Add per-domain input union with Grid variant and match dispatch#25

Merged
chuckwondo merged 1 commit into
mainfrom
feat/22-input-union-grid
Jun 26, 2026
Merged

Add per-domain input union with Grid variant and match dispatch#25
chuckwondo merged 1 commit into
mainfrom
feat/22-input-union-grid

Conversation

@chuckwondo

Copy link
Copy Markdown
Contributor

Summary

First of three stacked PRs splitting #18's Story-3 modeler work (part 2a).
Introduces the per-domain input union with only the Grid variant — a
behavior-preserving refactor plus the dispatch foundation that #23
(Point/PointSeries) and #24 (CoverageCollection) build on.

What changed

  • input.py: replace the single CoverageInput dataclass with
    _CoverageInputBase + GridInput; keep CoverageInput as a one-member
    type alias. Validation splits into a shared base __post_init__ plus a
    per-variant _validate_shape hook (GridInput requires 3-D
    (bands, height, width)).
  • imagedata_to_coverage_input() now returns GridInput and drops its
    geometry/timestamps parameters — on the Grid path they only ever
    reached NotImplementedError.
  • modeler.to_coverage: match/assert_never dispatch replacing the
    Grid-only guards. assert_never is version-guarded (stdlib on 3.11+,
    typing_extensions on 3.10), so adding a variant in Modeler part 2b: Point and PointSeries domains #23 without a case
    becomes a mypy error. typing-extensions is declared as a
    python_version < "3.11" conditional dependency.
  • Tests migrated to GridInput; the obsolete 2-D / geometry / timestamps
    and modeler-guard tests are removed (they return as Point-variant tests in
    Modeler part 2b: Point and PointSeries domains #23).
  • Docs: fold the decisions into docs/04-modeler-converter-design.md
    (Sections 4/4.1/7 + new 7.5, status callouts on the superseded 3/5.1), and
    refresh the resolved Polygon / covjson-pydantic 0.8.0 note.

Behavior

Behavior-preserving for the Grid path — emitted CoverageJSON is unchanged.
The one new behavior: a non-3-D array is rejected at GridInput construction
(ValueError) instead of reaching the modeler.

Testing

uv run pytest (251 passed, 100% coverage), ruff check, ruff format --check, and mypy all green on Python 3.10 and 3.13.

Part of #18. Closes #22.

🤖 Generated with Claude Code

Replace the single CoverageInput dataclass with _CoverageInputBase +
GridInput, keeping CoverageInput as a one-member alias. The modeler
dispatches via match/assert_never (version-guarded; typing-extensions
added as a 3.10-only conditional dependency), and
imagedata_to_coverage_input returns GridInput, dropping its unused
geometry/timestamps parameters. Non-3-D arrays now fail at construction
instead of in the modeler -- behavior-preserving for the Grid path.

Also fold the decisions into docs/04-modeler-converter-design.md
(Sections 4/4.1/7 + new 7.5, status callouts on 3/5.1) and refresh the
now-resolved Polygon / covjson-pydantic 0.8.0 note.

Part of #18.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@chuckwondo chuckwondo merged commit b25c4cf into main Jun 26, 2026
12 checks passed
@chuckwondo chuckwondo deleted the feat/22-input-union-grid branch June 26, 2026 16:59
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.

Modeler part 2a: per-domain input union (Grid only) + match dispatch

2 participants