Add loader for anemoi-inference projected grid (x/y) format#8
Draft
Add loader for anemoi-inference projected grid (x/y) format#8
Conversation
Agent-Logs-Url: https://github.com/mlwp-tools/mlwp-data-loaders/sessions/1a29ffc2-e5e4-4823-9933-0646ba9d5358 Co-authored-by: observingClouds <43613877+observingClouds@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for another anemoi-inference format
Add loader for anemoi-inference projected grid (x/y) format
Apr 22, 2026
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.
A second anemoi-inference output format exists in the wild where the spatial domain is a structured 2D projected grid (
y,xdims) rather than a flatvaluesdimension, and the forecast reference time is stored as an explicit scalar data variable (forecast_reference_time) rather than being inferred fromtime[0].New loader:
anemoi_inference_xysrc/mlwp_data_loaders/loaders/anemoi/anemoi_inference_xy.pyHandles the format:
Key transformations in
_preprocess(applied per-file before concatenation):forecast_reference_time→reference_timedimension coordinatelead_time = time - forecast_reference_timeand swaps it in for thetimedimensionlatitude/longitudeto coordinates if they arrive as data variablesforecast_reference_timeandprojectionscalarsOutput traits:
forecast/grid/deterministic— consistent with the existinganemoi_inferenceloader.Tests
tests/test_anemoi_inference_xy.py— 17 unit tests covering all_preprocesstransformations andload_datasetbehaviour (trait attrs, dimension structure, path coercion, variable preservation) using synthetic in-memory datasets.