Skip to content

feat: simple filter for removing metadata from fields#238

Draft
aaron-hopkinson wants to merge 3 commits intomainfrom
feat/drop_metadata_filter
Draft

feat: simple filter for removing metadata from fields#238
aaron-hopkinson wants to merge 3 commits intomainfrom
feat/drop_metadata_filter

Conversation

@aaron-hopkinson
Copy link
Contributor

Description

Adds a filter for removing metadata from fields. The primary use-case here is to use this to "force" a matching between fields when using a MatchingFieldFilter where the metadata is known to differ due to coming from different sources. Use this filter with caution.

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 marked this pull request as ready for review February 24, 2026 16:09
Comment on lines +22 to +23
required_inputs = ("keys",)
optional_inputs = {"param": None}
Copy link
Member

Choose a reason for hiding this comment

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

I'm starting to think this class could have just been a dataclass?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does way too much stuff to be a dataclass in my opinion. It only has two class level variables – I don't think that's too many

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(There's an argument for some of the class configuration itself being a dataclass, which is exactly what I've done for a WIP refactor of the MatchingFieldsFilter base class, but I'm reluctant to make further changes to SingleFieldFilter until that refactor goes in... Eventually these will all align, but we need to let the design settle a bit first - otherwise we risk having the wrong abstractions)

Comment on lines +22 to +23
required_inputs = ("keys",)
optional_inputs = {"param": None}
Copy link
Member

Choose a reason for hiding this comment

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

What's param here used for?

Copy link
Member

Choose a reason for hiding this comment

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

Update the docstring to make it clearer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(NB: Not 100% sure if we need this filter yet...)

@aaron-hopkinson aaron-hopkinson marked this pull request as draft February 27, 2026 13:03
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