Skip to content

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

Open
mauzey1 wants to merge 15 commits intomainfrom
937-only-write-parent-attr-when-required
Open

Only write parent attributes when they are required for parent experiments in CMIP7 datasets#940
mauzey1 wants to merge 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.

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

2 participants