Skip to content

Make TCR diagnostic compatible with CMIP7 data#686

Merged
lewisjared merged 10 commits into
Climate-REF:mainfrom
schlunma:tcr_cmip7
Jun 30, 2026
Merged

Make TCR diagnostic compatible with CMIP7 data#686
lewisjared merged 10 commits into
Climate-REF:mainfrom
schlunma:tcr_cmip7

Conversation

@schlunma

@schlunma schlunma commented May 22, 2026

Copy link
Copy Markdown
Contributor

Description

Addresses #647.

Checklist

Please confirm that this pull request has done the following:

  • Tests added
  • Documentation added (where applicable)
  • Changelog item added to changelog/

Summary by CodeRabbit

  • New Features

    • The TCR diagnostic now supports CMIP7 data.
    • Updated the diagnostic workflow to handle the revised CMIP7 dataset setup.
  • Bug Fixes

    • Improved handling of dataset branding details so results generate correctly for both CMIP6 and CMIP7.
    • Expanded test coverage and sample data to reflect additional supported model variants.

@schlunma

Copy link
Copy Markdown
Contributor Author

Will mark this as "ready for review" once corresponding ESMValTool PR has been merged.

@codecov

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
core 92.30% <ø> (ø)
providers 86.29% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...tool/src/climate_ref_esmvaltool/diagnostics/tcr.py 87.80% <100.00%> (+0.30%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- CMIP7.CMIP.MRI.MRI-ESM2-0.piControl.r1i2p1f1.glb.mon.tas.tavg-h2m-hxy-u.gn.v20191205
cmip7_gn_NESM3_r1i1p1f1:
cmip7:
- CMIP7.CMIP.NUIST.NESM3.1pctCO2.r1i1p1f1.glb.mon.tas.tavg-h2m-hxy-u.gn.v20190707

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This looks wrong, there's no parent experiment.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'll fix in a follow up. Its due to RequireContiguousTimerange being too sensitive.

@schlunma

Copy link
Copy Markdown
Contributor Author

I copied the obtained file from the failing regression test to make it pass here. However, I think there are some problems with this (see my comments).

Otherwise this is ready for review now.

@schlunma schlunma marked this pull request as ready for review May 29, 2026 13:09
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6c66228d-d36e-4be1-a912-2bc24786b339

📥 Commits

Reviewing files that changed from the base of the PR and between c4d48f1 and e2c5de8.

📒 Files selected for processing (4)
  • packages/climate-ref-esmvaltool/src/climate_ref_esmvaltool/diagnostics/tcr.py
  • packages/climate-ref-esmvaltool/src/climate_ref_esmvaltool/recipes.txt
  • packages/climate-ref-esmvaltool/tests/test-data/transient-climate-response/cmip6/manifest.json
  • packages/climate-ref-esmvaltool/tests/test-data/transient-climate-response/cmip7/manifest.json
✅ Files skipped from review due to trivial changes (1)
  • packages/climate-ref-esmvaltool/tests/test-data/transient-climate-response/cmip6/manifest.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/climate-ref-esmvaltool/src/climate_ref_esmvaltool/diagnostics/tcr.py

📝 Walkthrough

Walkthrough

The TCR diagnostic is updated to support CMIP7 data by switching the base recipe from recipe_tcr.yml to ref/recipe_ref_tcr.yml, replacing RequireFacets with explicit FacetFilter constraints in the CMIP7 DataRequirement, and revising update_recipe to strip branding_suffix from datasets and CMIP6 diagnostic variables. Test snapshots, manifests, and regression fixtures are updated accordingly.

Changes

TCR CMIP7 Support

Layer / File(s) Summary
TCR diagnostic: recipe ref, data requirements, and update_recipe logic
packages/climate-ref-esmvaltool/src/climate_ref_esmvaltool/diagnostics/tcr.py, packages/climate-ref-esmvaltool/src/climate_ref_esmvaltool/recipes.txt
base_recipe switched to ref/recipe_ref_tcr.yml; RequireFacets import dropped; CMIP7 DataRequirement now uses explicit FacetFilter constraints for branded_variable, experiment_id, frequency, and region; update_recipe strips branding_suffix from datasets and CMIP6 diagnostic variables rather than injecting a diagnostics block; recipes.txt manifest updated to reference the new recipe file.
Expected recipe YAML snapshots for CMIP6 and CMIP7
packages/climate-ref-esmvaltool/tests/unit/diagnostics/recipes/recipe_transient_climate_response_cmip6.yml, packages/climate-ref-esmvaltool/tests/unit/diagnostics/recipes/recipe_transient_climate_response_cmip7.yml
CMIP6 snapshot has preprocessors/diagnostics blocks repositioned; CMIP7 snapshot adds a top-level datasets block with activity: CMIP, removes branding_suffix from the dataset level, and moves it to diagnostics.tcr.variables.tas.
Test data manifests version bump
packages/climate-ref-esmvaltool/tests/test-data/transient-climate-response/cmip6/manifest.json, packages/climate-ref-esmvaltool/tests/test-data/transient-climate-response/cmip7/manifest.json
CMIP6 manifest bumps diagnostic_version to 2; CMIP7 manifest bumps diagnostic_version and test_case_version to 2 and populates native artifact metadata with sha256/size entries.
Regression test fixture: expanded CMIP7 model/variant mappings
packages/climate-ref-esmvaltool/tests/unit/test_solve_regression/test_solve_regression_transient_climate_response_.yml
Adds and extends cmip7_gn_* and cmip7_gr_* dataset mappings for CAMS-CSM1-0, CanESM5, FGOALS-g3, FIO-ESM-2-0, HadGEM3-GC31-LL/MM, NESM3, UKESM1-0-LL, EC-Earth3, and FGOALS-f3-L; removes two existing cmip7_gr_* entries.

Possibly related PRs

  • Climate-REF/climate-ref#770: Both PRs update transient-climate-response manifest.json files with diagnostic_version changes that affect the CI coupling gate comparing Diagnostic.version against manifest.diagnostic_version.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarises the main change: making the TCR diagnostic work with CMIP7 data.
Description check ✅ Passed The description includes the required Description section and the checklist items are completed.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

Bump TransientClimateResponse.version to 2 so the diagnostic-version gate
forces a recompute against the CMIP7-compatible recipe wiring rather than
reusing the version-1 execution group.

Align the shared ESMValTool pin with main (12cb5309) and mint the CMIP7
native baseline (CanESM5 1pctCO2), which now resolves through the CMIP7
conversion layer. Both CMIP6 and CMIP7 baselines replay-match the committed
bundle.
* origin/main: (27 commits)
  Bump version: 0.14.7 → 0.15.0
  test(esmvaltool): rebump ECS manifests to diagnostic_version 2
  chore(deps): bump the github-actions group with 2 updates
  docs: simplify gate comments and regression docs
  fix(test-cases): migrate-manifests preserves recorded diagnostic_version
  test(esmvaltool): mint ECS regression baselines for CMIP6 and CMIP7
  fix: backfill diagnostic_version for baselines merged from main
  docs: rename changelog entry to PR number 770
  feat(regression): couple Diagnostic.version into the CI coupling gate
  chore(esmvaltool): align ESMValTool pin and bump ECS version to 2
  feat(example): extract model/reference/bias time series as CMEC series
  refactor(example): rename diagnostic to global-sst-bias and drop version guard
  test: close NetCDF datasets in surface-temperature end-to-end tests
  feat(example): use ocean SST (tos) and add comparison figures
  test(example): mint regression baselines for surface-temperature-bias
  fix: address review feedback on surface temperature diagnostic
  test: update solver regression snapshots for new example diagnostic
  feat(example): add model-vs-obs surface temperature diagnostic and 5-minute quickstart
  fix: address review feedback
  chore: add changelog for config CLI uplift
  ...

# Conflicts:
#	packages/climate-ref-esmvaltool/tests/test-data/transient-climate-response/cmip7/manifest.json
After merging main's diagnostic-version gate, backfill diagnostic_version=2
on both TCR baselines from the in-code Diagnostic.version so the coupling
gate replays instead of flagging the manifests as stale.
@lewisjared lewisjared merged commit ff6c522 into Climate-REF:main Jun 30, 2026
21 checks passed
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.

3 participants