Skip to content

refactor(sources): migrate grib source off LegacySource#665

Open
frazane wants to merge 3 commits into
mainfrom
refactor/grib-retire-legacysource
Open

refactor(sources): migrate grib source off LegacySource#665
frazane wants to merge 3 commits into
mainfrom
refactor/grib-retire-legacysource

Conversation

@frazane

@frazane frazane commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Description

Migrates the grib source (GribSource) from LegacySource onto the modern Source base class. First step towards #553.

What problem does this change solve?

LegacySource is an intermediate base, kept for historical reasons, that stores *args/**kwargs and dispatches through a @staticmethod _execute, leaving sources split across two base classes. This moves grib onto the standard Source contract — config in __init__, retrieval in execute_valid_dates — mirroring the sibling GribIndexSource, which already does this with the same flavour/grid_definition config. Pure refactor: the _execute body moves verbatim, and the base-class execute_intervals -> execute_valid_dates fallback is unchanged.

What issue or task does this change relate to?

Related to #553.

Additional notes

Behaviour-preserving: building the same recipe with the pre- and post-change grib.py produces a bit-identical dataset (data, statistics, coordinates, dates, variables). test_grib passes unchanged.

This change was developed in tandem with AI coding agents.


As a contributor to the Anemoi framework, please ensure that your changes include unit tests, updates to any affected dependencies and documentation, and have been tested in a parallel setting (i.e., with multiple GPUs). As a reviewer, you are also responsible for verifying these aspects and requesting changes if they are not adequately addressed. For guidelines about those please refer to https://anemoi.readthedocs.io/en/latest/

By opening this pull request, I affirm that all authors agree to the Contributor License Agreement.

@aaron-hopkinson aaron-hopkinson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me - one optional/minor comment.

Thanks for doing this.

Comment thread src/anemoi/datasets/create/sources/grib.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: To be triaged

Development

Successfully merging this pull request may close these issues.

2 participants