Skip to content

fix(grouping): ignore metadata keys missing from some fields when matching - #327

Open
NRaoult wants to merge 1 commit into
mainfrom
fix/grouping-missing-mars-keys
Open

fix(grouping): ignore metadata keys missing from some fields when matching#327
NRaoult wants to merge 1 commit into
mainfrom
fix/grouping-missing-mars-keys

Conversation

@NRaoult

@NRaoult NRaoult commented Jul 10, 2026

Copy link
Copy Markdown
Member

Summary

  • GroupByParam (used by all MatchingFieldsFilter subclasses, e.g. land_parameters) groups fields by their full MARS-namespace metadata. Fields read from GRIB1 files without ECMWF local definitions (e.g. IFS climate files such as climate.v015/95_4/sfc) have no class/type/stream/expver keys, so they could never land in the same group as GRIB2 fields that carry those keys, and matching failed with Missing component. Want ['slt', 'tvh', 'tvl'], got ['slt'].
  • This PR makes grouping ignore metadata keys that are not present in every candidate field (a warning lists the ignored keys). Keys present in all fields still separate groups exactly as before.
  • Applied to both GroupByParam and GroupByParamVertical; regression tests added.

Motivation

Building aifs-l5-an-oper-0001-mars-o96-1979-2024-6h-v1-land failed in the land_parameters filter when joining repeated_dates sources for tvh/tvl (GRIB1, climate.v015/95_4/sfc) with slt (GRIB2, climate.v015/95_4/slt). Verified end-to-end with those files: the filter now produces all eight derived parameters, with a warning Ignoring metadata keys not present in all fields when grouping: ['class', 'domain', 'expver', 'stream', 'type'].

🤖 Generated with Claude Code

…ching

GroupByParam groups fields by their full MARS namespace metadata, so
fields from GRIB1 files without ECMWF local definitions (missing
class/type/stream/expver, e.g. IFS climate files such as
climate.v015/95_4/sfc) could never be matched with GRIB2 fields that
carry those keys. This broke MatchingFieldsFilter subclasses like
land_parameters when joining such files.

Keys that are not present in every candidate field are now ignored for
grouping (with a warning), while keys present in all fields still
separate groups as before.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-project-automation github-project-automation Bot moved this to To be triaged in Anemoi-dev Jul 10, 2026
@github-actions github-actions Bot added bug Something isn't working tests and removed bug Something isn't working labels Jul 10, 2026
@NRaoult
NRaoult requested a review from b8raoult July 10, 2026 11:07
@aaron-hopkinson

Copy link
Copy Markdown
Contributor

Discussed offline with @NRaoult.

I think this might automatically be addressed by #317 or #269 – let's merge those first and see if this is still required. If necessary, we can implement this after the ekd upgrade.

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