Add reusable remap weight support#1483
Open
rajeeja wants to merge 9 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a reusable “offline remap weights” workflow to UXarray so users can load precomputed sparse remapping operators (e.g., ESMF/TempestRemap map files) once and apply them repeatedly to UXarray objects.
Changes:
- Introduces a
RemapWeightsdataclass plusload_remap_weights()with a path-based cache for weight files. - Adds
UxDataArray.remap.apply_weights()/UxDataset.remap.apply_weights()to apply the sparse operator to the matching spatial dimension. - Adds focused tests and new documentation/user-guide material for applying external offline map files.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| uxarray/remap/weights.py | New loader + cached RemapWeights sparse operator implementation. |
| uxarray/remap/apply_weights.py | New implementation to apply a loaded operator to UXarray data variables. |
| uxarray/remap/accessor.py | Exposes apply_weights() on the .remap accessor and documents it in __repr__. |
| uxarray/remap/init.py | Exports new weights APIs (and _apply_weights). |
| uxarray/init.py | Re-exports RemapWeights and load_remap_weights at the top level. |
| test/precomputed_weights_test.py | New tests for loading, applying, and cache reuse. |
| docs/userguide.rst | Adds the new remap-weights guide to the user guide index / toctree. |
| docs/user-guide/remap-weights.rst | New user guide page describing external weight application workflow and file expectations. |
| docs/api.rst | Adds load_remap_weights, RemapWeights, and accessor methods to the public API docs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- prefer start_index attr; treat as 1-based only when max==size - reject non-spatial source_dim - preserve aux coords whose dims are subset of other_dims - document eager dask materialization - LRU-bound weights cache; add clear_remap_weights_cache() - use _open_dataset_with_fallback in RemapWeights.from_file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for loading and applying reusable offline remap weights through a generic RemapWeights API, including focused tests and docs for external ESMF and TempestRemap map files. Closes #172.