Skip to content

Document the obs4MIPs reference data that must come from ESGF, and test the fetch script against the requirements - #864

Merged
lewisjared merged 5 commits into
mainfrom
docs/obs4mips-fetch-requirements
Aug 13, 2026
Merged

Document the obs4MIPs reference data that must come from ESGF, and test the fetch script against the requirements#864
lewisjared merged 5 commits into
mainfrom
docs/obs4mips-fetch-requirements

Conversation

@lewisjared

@lewisjared lewisjared commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

The download tutorial covered the obs4REF registry and the CMIP6 input data, but never said which reference datasets neither of those provides. This adds that, plus a snippet for fetching them, plus tests that stop scripts/fetch-esgf.py drifting from the diagnostics.

What is actually needed from ESGF

Five obs4MIPs datasets are not in the obs4REF registry:

source_id Variables Required by
20CR-V2 psl pmp/extratropical-modes-of-variability-{nam,nao,npo,pna,sam}
C3S-GTO-ECV-9-0 toz esmvaltool/ozone-{annual-cycle,lat-time,nh-mar,sh-oct}
CERES-EBAF-4-2-1 rlut, rlutcs, rsut, rsutcs esmvaltool/cloud-radiative-effects
ERA-5 psl, ta, tas, ua esmvaltool/cloud-scatterplots-reference, esmvaltool/regional-historical-{annual-cycle,timeseries,trend}
NOAA-NCEI-LAI-AVHRR-5-0 lai ilamb/lai-avh15c1
python scripts/fetch-esgf.py --kind obs4mips

An unmet reference requirement plans no executions rather than failing, so missing one of these shows up as a diagnostic that silently never runs.

Summary by CodeRabbit

  • Documentation

    • Expanded dataset download guidance to cover CMIP7, ESGF fetching, storage requirements, optional and unpublished CMORised data, cache and ingest behaviour, missing data, and duplicate-data warnings.
    • Documented obs4MIPs reference datasets unavailable through the obs4REF registry, including the diagnostics, variables, sources, and commands required to obtain them from ESGF.
  • Tests

    • Added offline coverage checks confirming required datasets are obtainable and requested correctly, while identifying missing or outdated requests.

The download tutorial covered the obs4REF registry and the CMIP6 input data,
but never said which reference datasets neither of those provides. Five
obs4MIPs datasets are only available from ESGF: 20CR-V2 psl, C3S-GTO-ECV-9-0
toz, CERES-EBAF-4-2-1 rlut/rlutcs/rsut/rsutcs, ERA-5 psl/ta/tas/ua, and
NOAA-NCEI-LAI-AVHRR-5-0 lai. Missing any of them costs you the diagnostics
that need it, and because an unmet reference requirement plans no executions
rather than failing, the loss is silent.

Document them with the diagnostics that require each, and give the
`--kind obs4mips` snippet that fetches just this data.

scripts/fetch-esgf.py maintains its request list by hand, and its TODO to
derive the list from the data requirements is still open, so add tests that
check the two against each other: every required source_id is either in the
obs4REF registry or requested here, every dataset a requirement can select
from the committed ESGF catalog snapshot is fetched, and no request names a
source_id nothing requires. Each was confirmed to fail when the corresponding
drift is introduced.

The requirement side cannot be checked by taking the cross product of a
requirement's facets: ESGF intersects facets, so the PMP ENSO requirement
naming four sources and eight variables would appear to need 32 combinations
when only 12 exist. The tests resolve against the catalog instead, which is
also why the snapshot has to be filtered to its ESGF rows -- it is built from
an archive that holds the obs4REF collection too.

Constraint: The committed catalog snapshot only covers datasets someone has already downloaded, so the pair-level test cannot see a brand new source; the source-level test covers that case
Rejected: Generate the request list from the data requirements now | the facet intersection means a generated list needs per-source grouping logic, which is the open TODO, not a docs change
Confidence: high
Scope-risk: narrow
Directive: When adding an obs4MIPs data requirement, add or extend an Obs4MIPsRequest grouped by source_id -- one request naming several sources and several variables returns nothing
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change documents ESGF retrieval for obs4MIPs reference datasets and adds offline coverage tests. It clarifies diagnostic requirements, duplicate dataset handling, request grouping, and the 20CR-V2 source ID.

Changes

obs4MIPs ESGF fetching

Layer / File(s) Summary
Fetch guidance and request metadata
docs/getting-started/02-download-datasets.md, scripts/fetch-esgf.py, changelog/864.docs.md
Documents CMIP7 and obs4MIPs input requirements, ESGF commands, cache and ingest behaviour, missing-data handling, duplicate dataset handling, and version selection. The fetch script comments describe the coverage limitation and retain the 20CR-V2 request.
ESGF request coverage validation
tests/scripts/test_fetch_esgf_coverage.py
Adds offline tests that compare provider requirements and the committed ESGF catalogue with fetch-script requests. The tests detect missing required sources, missing selectable datasets, and stale requests.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly states the documentation change and the added fetch-script requirement tests.
Description check ✅ Passed The description clearly explains the change and ESGF requirements, but it omits the template checklist and explicit changelog confirmation.
✨ Finishing Touches 💡 1
⚔️ Resolve merge conflicts 💡
  • Resolve merge conflict in branch docs/obs4mips-fetch-requirements
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/obs4mips-fetch-requirements

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

…vers it

The note added in the previous commit said fetching both the obs4REF and the
ESGF copy of a dataset was safe because same-version copies share an
instance_id and ingest as one dataset. They do ingest as one dataset, but that
dataset then holds both sets of files. GPCP-Monthly-3-2 pr v20231205 ends up
with 42: obs4REF's single 1983-2023 file plus ESGF's 41 yearly files covering
the same period. A diagnostic reading it sees every time step twice, and both
pmp/enso_tel and pmp/enso_proc read it.

Recommend the five ESGF-only datasets by request id instead of --kind
obs4mips, which also pulls the four duplicated ones, and keep --kind obs4mips
for deployments that do not use the obs4REF registry.

This is guidance for the current behaviour, not a fix. The fix is for the
catalog to prefer the published obs4MIPs copy over the obs4REF one at the same
version, which needs the obs4REF datasets to be ingested as their own source
type first.

Constraint: obs4REF and ESGF copies at the same version are indistinguishable once ingested, because both carry activity_id obs4MIPs and merge on instance_id before anything can choose between them
Confidence: high
Scope-risk: narrow
Not-tested: The downstream effect on a diagnostic execution is inferred from the duplicated file list, not observed in a completed run
@lewisjared

Copy link
Copy Markdown
Contributor Author

Correcting the note I added about fetching both copies of a dataset: it is not safe, and I have pushed a fix.

Same-version copies do share an instance_id and ingest as one dataset — but that dataset then holds both sets of files. GPCP-Monthly-3-2 pr v20231205 ends up with 42 files: the obs4REF registry's single 1983–2023 file plus the ESGF mirror's 41 yearly files covering the same period. Any diagnostic reading it sees every time step twice, and both pmp/enso_tel and pmp/enso_proc do. TropFlux-1-0 hfls/hfss/tauu and HadISST-1-1 ts are the same, with the identical file attached twice.

This means the workflow the tutorial previously implied (fetch the obs4REF registry, then fetch-esgf.py --kind obs4mips) produces double-covered reference datasets today. The docs now recommend the five ESGF-only datasets by request id and keep --kind obs4mips for deployments not using the obs4REF registry.

That is guidance, not a fix. The fix is for the catalog to prefer the published obs4MIPs copy at the same version, which needs the obs4REF datasets ingested as their own source type first — tracked as follow-up work.

@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: 71c26ca2-a681-4877-8139-b5a51508b575

📥 Commits

Reviewing files that changed from the base of the PR and between 0e867e4 and 613dd9d.

📒 Files selected for processing (4)
  • changelog/864.docs.md
  • docs/getting-started/02-download-datasets.md
  • scripts/fetch-esgf.py
  • tests/scripts/test_fetch_esgf_coverage.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • changelog/864.docs.md
  • tests/scripts/test_fetch_esgf_coverage.py
  • scripts/fetch-esgf.py

Comment thread docs/getting-started/02-download-datasets.md Outdated
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
core 93.49% <ø> (ø)
providers 87.70% <ø> (ø)

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

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

@lewisjared
lewisjared merged commit 4036d30 into main Aug 13, 2026
24 checks passed
@lewisjared
lewisjared deleted the docs/obs4mips-fetch-requirements branch August 13, 2026 05:37
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