Skip to content

Only write parent attributes when they are required for parent experiments in CMIP7 datasets#940

Merged
mauzey1 merged 15 commits intomainfrom
937-only-write-parent-attr-when-required
Apr 16, 2026
Merged

Only write parent attributes when they are required for parent experiments in CMIP7 datasets#940
mauzey1 merged 15 commits intomainfrom
937-only-write-parent-attr-when-required

Conversation

@mauzey1
Copy link
Copy Markdown
Collaborator

@mauzey1 mauzey1 commented Apr 14, 2026

Resolves #937

Adds CMIP7-specific requirements for parent experiments (parent_experiment_id) and other parent attributes. These are enabled by setting "_cmip7_option": 1 in the user input JSON.

For experiments with no parent experiments defined in the CV, CMOR now warns on stray parent attributes and removes them from the dataset before writing. It also hard-errors when a user supplies parent_experiment_id for an experiment that should not have one, and when a required parent_experiment_id is missing for an experiment that does define parents.

Test/test_cmor_parent_attrs.py covers the following cases:

  • CMIP7 output with no parent attributes for no-parent experiments.
  • CMIP7 output with the full required parent attribute set for experiments like historical.
  • Warning-and-removal behavior when stray parent attributes are present without a parent experiment.
  • Erroring when a user defines parent_experiment_id for an experiment whose CV lists no parents.
  • Erroring when a required parent_experiment_id is omitted.
  • Erroring when the user supplies a parent experiment not allowed by the CV.
  • Erroring when the user supplies an incorrect parent_activity_id.

@matthew-mizielinski

@mauzey1 mauzey1 requested review from durack1 and taylor13 April 14, 2026 17:10
@taylor13
Copy link
Copy Markdown
Collaborator

The changes listed above seem sufficient to handle everything the way we want. I've looked at the code changes briefly and didn't notice any issues, but can't say that should be a consideration.

@mauzey1 mauzey1 mentioned this pull request Apr 15, 2026
Copy link
Copy Markdown
Collaborator

@durack1 durack1 left a comment

Choose a reason for hiding this comment

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

@mauzey1 looks good to me.

@matthew-mizielinski did you have the appetite to take a peek at this - honestly, it might be quicker to get the release done, and check this once live

@mauzey1 mauzey1 merged commit c703d07 into main Apr 16, 2026
15 checks passed
@mauzey1 mauzey1 deleted the 937-only-write-parent-attr-when-required branch April 16, 2026 23:16
@mauzey1 mauzey1 mentioned this pull request Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

urgent release requested

3 participants