Context
DatasetCollection.from_stac carried 14 parameters, five of which (like, crs, resolution, bounds, anchor)
describe one thing — the target output grid — with runtime-enforced invariants (like xor the trio; the trio is
all-or-nothing). Same class of too-many-arguments smell tracked for to_cog in #757 (python:S107).
Problem / Current Behaviour
The five loose kwargs bloat the signature and scatter validation inside _resolve_target_grid.
Affected locations
| File |
Symbol |
Notes |
src/pyramids/dataset/grid.py |
Grid (new) |
frozen dataclass + __post_init__ validation |
src/pyramids/dataset/collection.py |
DatasetCollection.from_stac |
5 kwargs -> grid: Grid | None |
src/pyramids/dataset/_stac.py |
from_stac, _resolve_target_grid |
take a Grid |
Proposed Solution
from pyramids.dataset import Grid
DatasetCollection.from_stac(items, "B04", grid=Grid(crs=32633, resolution=10, bounds=(...)))
Drops from_stac from 14 to 10 params; mirrors odc.stac.load's geobox= grouping.
Out of Scope
from_point (tracked separately); other constructors.
Effort Estimate
Size: S — new dataclass + signature change + test migration.
Definition of Done
Relates to #757 (same S107 parameter-count reduction). Implemented in PR #951.
Context
DatasetCollection.from_staccarried 14 parameters, five of which (like,crs,resolution,bounds,anchor)describe one thing — the target output grid — with runtime-enforced invariants (
likexor the trio; the trio isall-or-nothing). Same class of too-many-arguments smell tracked for
to_cogin #757 (python:S107).Problem / Current Behaviour
The five loose kwargs bloat the signature and scatter validation inside
_resolve_target_grid.Affected locations
src/pyramids/dataset/grid.pyGrid(new)__post_init__validationsrc/pyramids/dataset/collection.pyDatasetCollection.from_stacgrid: Grid | Nonesrc/pyramids/dataset/_stac.pyfrom_stac,_resolve_target_gridGridProposed Solution
Drops
from_stacfrom 14 to 10 params; mirrorsodc.stac.load'sgeobox=grouping.Out of Scope
from_point(tracked separately); other constructors.Effort Estimate
Size:
S— new dataclass + signature change + test migration.Definition of Done
Griddataclass with mode-invariant validation, exported frompyramids.datasetfrom_stactakesgrid=Grid(...)(breaking; no alias)Relates to #757 (same S107 parameter-count reduction). Implemented in PR #951.