Ability to choose between multiple observations in one file - #35
Draft
mvertens wants to merge 12 commits into
Draft
Ability to choose between multiple observations in one file#35mvertens wants to merge 12 commits into
mvertens wants to merge 12 commits into
Conversation
…1 and scale_offset=0
…y with new obs formulas
…ervation derivation formula
…a_obs → obs_derivation_formula
…_variable_defaults.yaml
mvertens
marked this pull request as draft
July 24, 2026 16:43
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.
Summary
Some variables can be compared against more than one observational dataset — for example ERA5 at native resolution or ERA5 regridded to 1°, or ERAI or ERA5. Until now, supporting both meant keeping two near-identical copies of the whole defaults file (
adf_variable_defaults.yamlandadf_variable_defaults_era5-1deg.yaml), which was confusing and painful to keep in sync.This change lets a variable list several observations in one place, and lets you pick which one a run uses with a single config setting — so the duplicate file goes away entirely.
How you use it
In the variable defaults, a variable lists its observation options under
obs_datasets(each option is self-contained — its own file, name, units, and derivation):Then, in
diag_basic_info, one setting chooses which observation the whole run uses:What gets picked:
obs_sourceis matched against each variable'sobs_name. The rules:obs_sourcematches one of the variable'sobs_namesobs_sourceis set but the variable doesn't offer itobs_sourceis not set at allSo the convention is simple: list the default observation first, and each run picks a source with one line. A variable that doesn't offer that source quietly falls back to its default, so a run never loses a comparison unexpectedly.
A couple of nice consequences:
adf_variable_defaults_era5-1deg.yamlwas deleted. To switch resolutions you now flip one config line instead of swapping whole files.at 1°).
obs_sourceisn't set everything uses its default. The model side is untouched.Testing
Verified end-to-end: the real converted YAML resolves correctly through the obs catalog and the data loader,
obs_sourceselects native vs 1° (and handles the ERAI-vs-ERA5 case) as expected, and single-observation entries are unchanged. Allthree defaults files were converted with an automated check confirming no observation value or other attribute was altered.