Skip to content

feat(example): model-vs-obs surface temperature diagnostic and 5-minute quickstart#769

Merged
lewisjared merged 8 commits into
mainfrom
feat/quickstart-model-vs-obs
Jun 30, 2026
Merged

feat(example): model-vs-obs surface temperature diagnostic and 5-minute quickstart#769
lewisjared merged 8 commits into
mainfrom
feat/quickstart-model-vs-obs

Conversation

@lewisjared

@lewisjared lewisjared commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a five-minute quick start that gets a new user from install to diagnostic results without building any provider environments or downloading the full reference archive.

Two parts:

  • New example diagnostic global-mean-surface-temperature-bias (GlobalMeanSurfaceTemperatureBias). It compares modelled annual global-mean surface temperature (ts) against the HadISST-1-1 observational record, using cosine-of-latitude weighting (no areacella needed). The output NetCDF exposes the model series, the reference series, and the bias, and the metric bundle reports rmse and mean-bias. It supports both CMIP6 and CMIP7 model data via an AND-grouped (model, obs4MIPs reference) requirement. A latest_version_files() guard ensures that when more than one reference version is present (the full obs4REF archive ships two HadISST-1-1 ts versions) only the latest is used, rather than combining overlapping time ranges.

  • Single-page quick start (docs/getting-started/quickstart.md, linked in the nav as "Quick Start"). It installs climate-ref and the pure-Python climate-ref-example provider into a virtual environment, configures with ref config init, fetches the curated sample data plus a single surface-temperature observation from a new quickstart data registry (a one-file subset of obs4REF, avoiding the multi-gigabyte download), ingests, runs the diagnostics with ref solve --provider example, and inspects the results.

Stacked on #768 because the quick start uses ref config init. Rebase onto main once #768 merges.

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
    • Added a five-minute Quick Start guide covering setup, configuration, curated data retrieval, ingestion, running diagnostics, and next steps.
    • Introduced a global mean surface temperature bias diagnostic comparing model output against HadISST-1-1, including RMSE/mean-bias and generated plots plus CMEC bundles.
    • Added a smaller curated “quickstart” dataset registry for faster getting-started workflows.
  • Documentation
    • Updated the documentation navigation to include the new Quick Start page.
  • Bug Fixes
    • Improved behaviour when multiple reference dataset versions are available by selecting the latest reference.
  • Maintenance
    • Updated the example package’s minimum supported xarray version.

…minute quickstart

Add a GlobalMeanSurfaceTemperatureBias diagnostic to the example provider that
compares modelled global-mean surface temperature against HadISST-1-1
observations, exposing the model, reference and bias series plus rmse/mean-bias
metrics. Add a curated 'quickstart' data registry holding the single reference
file it needs, and a single-page five-minute quickstart guide that installs into
a virtual environment, fetches a small dataset, runs the diagnostics and inspects
results.
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a new GlobalMeanSurfaceTemperatureBias diagnostic, a curated quickstart dataset registry entry, and a five-minute Quick Start guide. Supporting provider registration, fixtures, and tests are added alongside updated regression data.

Changes

Global mean surface temperature bias and quick start

Layer / File(s) Summary
Quick Start guide and navigation
changelog/769.feature.md, docs/getting-started/quickstart.md, mkdocs.yml
Adds the quick start guide, updates MkDocs navigation, and records the guide and diagnostic in the changelog.
Dataset registry and dependency update
packages/climate-ref/src/climate_ref/__init__.py, packages/climate-ref/src/climate_ref/dataset_registry/quickstart.txt, packages/climate-ref-example/pyproject.toml
Adds the quickstart dataset registry entry and raises the example package's xarray minimum version.
GlobalMeanSurfaceTemperatureBias implementation
packages/climate-ref-example/src/climate_ref_example/surface_temperature.py
Adds the helper functions, comparison logic, plotting, CMEC bundle formatters, and the diagnostic execution and result-building code.
Provider registration and solver fixtures
packages/climate-ref-example/src/climate_ref_example/__init__.py, packages/climate-ref-example/tests/unit/test_provider.py, packages/climate-ref/tests/unit/test_solve_regression/test_solve_regression_global_mean_surface_temperature_bias_.yml, packages/climate-ref/tests/unit/test_solver/test_solve_metrics.yml
Registers the new diagnostic with the example provider and updates solver fixtures for the new dataset pairing.
Regression test data and catalog fixtures
packages/climate-ref-example/tests/test-data/global-mean-surface-temperature-bias/...
Adds the default and CMIP7 catalog, manifest, regression, output, and series fixtures for the new diagnostic.
Unit and end-to-end tests
packages/climate-ref-example/tests/unit/test_surface_temperature.py
Adds synthetic-data helpers, unit coverage for the diagnostic helpers, and end-to-end run checks for the diagnostic and version selection behaviour.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarises the two main changes: a surface temperature diagnostic and a five-minute quickstart.
Description check ✅ Passed The description matches the required template with a Description section and a completed Checklist covering tests, docs, and changelog.
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
  • Commit unit tests in branch feat/quickstart-model-vs-obs

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

Base automatically changed from feat/cli-config-uplift to main June 30, 2026 04:50

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/climate-ref-example/tests/unit/test_surface_temperature.py (1)

111-167: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Please add one runnable CMIP7 case.

The implementation now has a separate CMIP7 requirement group and a CMIP7 branch in _get_model_source_type(), but the executable tests added here still only drive CMIP6 inputs. A small definition_factory(cmip7=...) case would stop that path from regressing silently.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dd057352-6082-4ab9-8994-84a0332d569f

📥 Commits

Reviewing files that changed from the base of the PR and between 29ff532 and ceb40f5.

📒 Files selected for processing (11)
  • changelog/769.feature.md
  • docs/getting-started/quickstart.md
  • mkdocs.yml
  • packages/climate-ref-example/src/climate_ref_example/__init__.py
  • packages/climate-ref-example/src/climate_ref_example/surface_temperature.py
  • packages/climate-ref-example/tests/unit/test_provider.py
  • packages/climate-ref-example/tests/unit/test_surface_temperature.py
  • packages/climate-ref/src/climate_ref/__init__.py
  • packages/climate-ref/src/climate_ref/dataset_registry/quickstart.txt
  • packages/climate-ref/tests/unit/test_solve_regression/test_solve_regression_global_mean_surface_temperature_bias_.yml
  • packages/climate-ref/tests/unit/test_solver/test_solve_metrics.yml

Comment thread packages/climate-ref-example/src/climate_ref_example/surface_temperature.py Outdated
Comment thread packages/climate-ref-example/src/climate_ref_example/surface_temperature.py Outdated
@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

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

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

Files with missing lines Coverage Δ
...te-ref-example/src/climate_ref_example/__init__.py 100.00% <100.00%> (ø)
...ple/src/climate_ref_example/surface_temperature.py 100.00% <100.00%> (ø)
packages/climate-ref/src/climate_ref/__init__.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Close xarray datasets via context managers in the surface-temperature
diagnostic, raise the climate-ref-example xarray floor to >=2025.1.0 (the
public xarray.coders.CFDatetimeCoder API), and add a runnable CMIP7
end-to-end test case.
Mint native baselines for the global-mean-surface-temperature-bias diagnostic
(default CMIP6 and cmip7 test cases) against HadISST-1-1, recording the committed
CMEC bundles and manifests. Native blobs are stored in the ref-baselines-public
object store; replay verified both cases match.
Switch the surface-temperature-bias diagnostic from global ts to ocean tos,
area-weighted by areacello, for a like-for-like comparison against HadISST-1-1
SST (units aligned to degC). This collapses the previous ~2.7 K coverage-mismatch
artefact to a physically sensible ~0.5 K bias. Add two figures (model vs reference
series, and the bias over time) to the output bundle, and re-mint the regression
baselines.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2307cee4-62e9-4ed6-aa14-89393527705b

📥 Commits

Reviewing files that changed from the base of the PR and between 8fba800 and 5d8e03c.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (14)
  • changelog/769.feature.md
  • docs/getting-started/quickstart.md
  • packages/climate-ref-example/pyproject.toml
  • packages/climate-ref-example/src/climate_ref_example/surface_temperature.py
  • packages/climate-ref-example/tests/test-data/global-mean-surface-temperature-bias/cmip7/catalog.yaml
  • packages/climate-ref-example/tests/test-data/global-mean-surface-temperature-bias/cmip7/manifest.json
  • packages/climate-ref-example/tests/test-data/global-mean-surface-temperature-bias/cmip7/regression/diagnostic.json
  • packages/climate-ref-example/tests/test-data/global-mean-surface-temperature-bias/cmip7/regression/output.json
  • packages/climate-ref-example/tests/test-data/global-mean-surface-temperature-bias/default/catalog.yaml
  • packages/climate-ref-example/tests/test-data/global-mean-surface-temperature-bias/default/manifest.json
  • packages/climate-ref-example/tests/test-data/global-mean-surface-temperature-bias/default/regression/diagnostic.json
  • packages/climate-ref-example/tests/test-data/global-mean-surface-temperature-bias/default/regression/output.json
  • packages/climate-ref-example/tests/unit/test_surface_temperature.py
  • packages/climate-ref/tests/unit/test_solver/test_solve_metrics.yml
✅ Files skipped from review due to trivial changes (8)
  • packages/climate-ref-example/tests/test-data/global-mean-surface-temperature-bias/cmip7/regression/diagnostic.json
  • packages/climate-ref-example/tests/test-data/global-mean-surface-temperature-bias/cmip7/manifest.json
  • packages/climate-ref-example/tests/test-data/global-mean-surface-temperature-bias/default/manifest.json
  • changelog/769.feature.md
  • docs/getting-started/quickstart.md
  • packages/climate-ref-example/tests/test-data/global-mean-surface-temperature-bias/default/regression/diagnostic.json
  • packages/climate-ref-example/tests/test-data/global-mean-surface-temperature-bias/cmip7/catalog.yaml
  • packages/climate-ref-example/pyproject.toml
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/climate-ref-example/tests/test-data/global-mean-surface-temperature-bias/default/regression/output.json
  • packages/climate-ref-example/tests/test-data/global-mean-surface-temperature-bias/cmip7/regression/output.json

Comment thread packages/climate-ref-example/tests/unit/test_surface_temperature.py Outdated
…ion guard

Rename the diagnostic slug to global-sst-bias (and the committed baseline and
solver-regression snapshot to match). Remove the latest_version_files helper: the
catalog/solver already returns only the latest dataset version, so the per-execution
guard is redundant. The diagnostic now passes the collection paths directly.
Emit the annual model, reference and bias SST series from global-sst-bias as
SeriesMetricValue values so they are ingested into the REF database and queryable
alongside the scalar metrics, not just available inside the NetCDF. Re-mint the
baselines to capture the populated series.json.
@lewisjared lewisjared merged commit 7207ab9 into main Jun 30, 2026
28 checks passed
@lewisjared lewisjared deleted the feat/quickstart-model-vs-obs branch June 30, 2026 07:50
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.

1 participant