Skip to content

Update StaticInputs coordinate handling#998

Draft
frodre wants to merge 1 commit intorefactor/closed-interval-subsetfrom
refactor/static-input-coordinates
Draft

Update StaticInputs coordinate handling#998
frodre wants to merge 1 commit intorefactor/closed-interval-subsetfrom
refactor/static-input-coordinates

Conversation

@frodre
Copy link
Collaborator

@frodre frodre commented Mar 21, 2026

PR 2/3 for #971 split

Changes:

  • Tests added

  fme/downscaling/data/static.py — major refactor:
  - StaticInput: removed coords field; now just holds data; subset() takes slices (not intervals)
  - Added _load_coords_from_ds(), load_fine_coords_from_path() for loading coords from files
  - Added _has_legacy_coords_in_state(), _has_coords_in_state(), _sync_state_coordinates() for backwards-compat state migration
  - StaticInputs: added coords: LatLonCoordinates as first-class field; removed per-field coord validation; subset() now returns updated
  coords; to_device() moves coords too; get_state() includes top-level "coords"; from_state() raises if coords absent; added
  from_state_backwards_compatible()
  - _get_normalized_static_input(): returns (StaticInput, LatLonCoordinates) tuple
  - load_static_inputs(): no longer accepts None; validates coord consistency across fields

  fme/downscaling/data/test_static.py — full replacement with new test suite covering all new APIs

  fme/downscaling/data/__init__.py — added load_fine_coords_from_path export

  fme/downscaling/test_models.py — updated make_static_inputs() to new StaticInputs interface

  fme/downscaling/inference/test_inference.py — updated get_static_inputs() helper

  fme/downscaling/train.py — guarded load_static_inputs call against None config# Please enter the commit message for your changes. Lines starting
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.

1 participant