Skip to content

Resample: accept a plain dict for method_overrides - #242

Merged
amarcozzi merged 1 commit into
mainfrom
241-resample-method-overrides
Oct 16, 2026
Merged

amarcozzi merged 1 commit into
mainfrom
241-resample-method-overrides

Conversation

@amarcozzi

Copy link
Copy Markdown
Contributor

Closes #241

Stacked on #240, which is stacked on #239. GitHub retargets it when those merge.

Grid.resample(method_overrides={...}) crashed in the client with AttributeError: 'dict' object has no attribute 'to_dict', because the generated CreateResampleRequest only serializes a CreateResampleRequestMethodOverrides instance.

Changes

  • _build_method_overrides (new, private), used by resample:

    • None sends nothing
    • a CreateResampleRequestMethodOverrides instance is passed through unchanged
    • a mapping of band key → method has each method checked as a ResamplingMethod, then is converted with CreateResampleRequestMethodOverrides.from_dict
    • anything else raises ValueError

    A bad method raises ValueError before any request, and the message names the band. This matches the other mapping-or-model builders: _build_chm_spike_filter, _build_boundary_scatter, _build_crown_segmentation.

  • Docstring: method_overrides is documented as Mapping[str, str], with an example and a Raises entry.

  • Tests (tests/v2/test_grids.py, TestResample):

    • the request body for a dict
    • the model instance passed through
    • invalid values raise before a request is sent
    • a live resample with {"aspect": "nearest"} that checks the stored source.method_overrides

Compatibility

Not breaking: an existing CreateResampleRequestMethodOverrides argument still works.

Verification

  • pytest tests/v2/test_grids.py -k TestResample against prod: 21 passed. The live test checks that prod stores the overrides; it doesn't run the resample job.

Base automatically changed from 238-resample-alignment to main October 16, 2026 20:45
@amarcozzi
amarcozzi merged commit d7b9e29 into main Oct 16, 2026
@amarcozzi
amarcozzi deleted the 241-resample-method-overrides branch October 16, 2026 20:45
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.

Resample: accept a plain dict for method_overrides

1 participant