Skip to content

feat: masking-filter based on other fields in the dataset#280

Closed
mpvginde wants to merge 5 commits into
mainfrom
feat/apply_mask_from_field
Closed

feat: masking-filter based on other fields in the dataset#280
mpvginde wants to merge 5 commits into
mainfrom
feat/apply_mask_from_field

Conversation

@mpvginde
Copy link
Copy Markdown
Contributor

Description

Adds apply_mask_from_field, a companion to the existing apply_mask_fields filter.
Where apply_mask_fields loads a mask from an external file, apply_mask_from_field derives the mask from another field already present in the data pipeline (e.g. a land-sea mask sourced alongside the other variables).

Usage:

        input:
          pipe:
            - source: # Can be `mars`, `netcdf`, etc.
               param: [lsm, sst, ...]
            - apply_mask_from_field:
                mask_param: lsm
                param: [sst]
                threshold_operator: ">=" # Operator to use for thresholding
                threshold: 0.5 # Will set to NaN all values where mask >= 0.5

Masked points are set to NaN. An optional rename suffix can be appended to the output param name.
The filter passes mask_param and any other non-targeted fields through unchanged.

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.

@github-actions github-actions Bot added the tests label Apr 20, 2026
@mpvginde
Copy link
Copy Markdown
Contributor Author

This functionality is already covered in #277

@mpvginde mpvginde closed this Apr 20, 2026
@aaron-hopkinson
Copy link
Copy Markdown
Contributor

Great minds think alike, @mpvginde, @mc4117 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants