Skip to content

feat: add obs4REF and ESMValTool reference dataset types - #805

Merged
lewisjared merged 2 commits into
mainfrom
feat/reference-dataset-models
Jul 10, 2026
Merged

feat: add obs4REF and ESMValTool reference dataset types#805
lewisjared merged 2 commits into
mainfrom
feat/reference-dataset-models

Conversation

@lewisjared

@lewisjared lewisjared commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Description

Adds two new source dataset types, obs4REF and ESMValToolReference, along with their tables. This is schema only. Neither can be ingested yet, so the adapters, solver wiring and registry changes follow separately.

  • Extracts the column block shared by Obs4MIPsDataset and PMPClimatologyDataset into a ReferenceDatasetMixin. No existing table changes.
  • obs4REF is REF-curated observational data following the obs4MIPs conventions that has not been published to ESGF. It reuses the mixin.
  • ESMValToolReference is ESMValTool's own reference data. It is not CMOR compliant, so it has its own smaller column set.
  • ESMValToolReference records frequency and no MIP table, because native6 never carries one. frequency_from_mip_table reduces the OBS/OBS6 table (Amon to mon). It is non-nullable because it is part of the dataset identity.

Checklist

Please confirm that this pull request has done the following:

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

Extract the obs4MIPs-style column block shared by `Obs4MIPsDataset` and
`PMPClimatologyDataset` into a `ReferenceDatasetMixin`, then declare two new
polymorphic subtypes on top of the `Dataset` hierarchy.

`obs4REF` is REF-curated observational data that follows the obs4MIPs metadata
conventions but has not been published to the obs4MIPs ESGF archive. It reuses
the mixin unchanged. `ESMValToolReference` is ESMValTool's own reference data,
which is not CMOR compliant, so it carries a smaller column set of its own.

The mixin extraction changes no existing table. `obs4mips_dataset` and
`pmp_climatology_dataset` keep exactly the columns they had.

The migration is not deferrable. `executor/reingest.py` queries datasets with
`with_polymorphic(Dataset, "*")`, which joins every mapped subtype table whether
or not rows of that type exist, so declaring a model without its table breaks
`reconstruct_execution_definition` on every database.

ESMValTool reference data records `frequency` and no MIP table. `native6` data
carries a frequency and never a table, while `OBS`/`OBS6` carry a table that
reduces to one, so frequency is the only axis both layouts share. Adds
`frequency_from_mip_table` to do that reduction (`Amon` -> `mon`). The mapping is
enumerated rather than derived from the table name, because `Oclim` -> `monC`,
`E1hrClimMon` -> `1hrCM` and the zonal-mean tables do not follow the suffix rule.

Neither type can be ingested yet. The adapters, solver wiring and registry
changes follow separately.
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@lewisjared, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 58 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 94675ca5-1380-4fc6-b772-709e0343cfa9

📥 Commits

Reviewing files that changed from the base of the PR and between 9999834 and a6d11be.

📒 Files selected for processing (8)
  • changelog/805.feature.md
  • packages/climate-ref-core/src/climate_ref_core/source_types.py
  • packages/climate-ref/src/climate_ref/datasets/utils.py
  • packages/climate-ref/src/climate_ref/migrations/versions/2026-07-10T0000_e1f2a3b4c5d6_add_reference_dataset_subtypes.py
  • packages/climate-ref/src/climate_ref/models/dataset.py
  • packages/climate-ref/tests/unit/datasets/test_migrations_reference_subtypes.py
  • packages/climate-ref/tests/unit/datasets/test_utils.py
  • packages/climate-ref/tests/unit/models/test_reference_dataset_models.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/reference-dataset-models

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.

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

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

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

Files with missing lines Coverage Δ
...mate-ref-core/src/climate_ref_core/source_types.py 93.75% <100.00%> (+0.89%) ⬆️
...ages/climate-ref/src/climate_ref/datasets/utils.py 94.16% <100.00%> (+0.36%) ⬆️
...ages/climate-ref/src/climate_ref/models/dataset.py 98.18% <100.00%> (+0.05%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lewisjared
lewisjared merged commit aabe013 into main Jul 10, 2026
28 checks passed
@lewisjared
lewisjared deleted the feat/reference-dataset-models branch July 10, 2026 04:41
lewisjared added a commit to schlunma/climate-ref that referenced this pull request Jul 13, 2026
Add the adapters that turn the obs4REF and ESMValTool reference dataset
types (added in Climate-REF#805) into ingestible source types.

- `Obs4REFDatasetAdapter` subclasses the obs4MIPs adapter. obs4REF shares
  the obs4MIPs metadata conventions, so it reuses the parser and only
  overrides the accepted activity ids and the instance_id prefix.
- `parse_obs4mips` gains an `accepted_activity_ids` hook. A file whose
  activity_id is outside the adapter's set but is still a known
  obs4MIPs/obs4REF id is ingested with a warning rather than rejected.
  The hard-reject cutover for that cross-contamination case is a tracked
  follow-up.
- `ESMValToolReferenceDatasetAdapter` parses ESMValTool's own layout
  (`OBS`/`OBS6`, `native6` and non-compliant `obs4MIPs` subtrees). It
  records `frequency`, reducing the `OBS`/`OBS6` MIP table to it via
  `frequency_from_mip_table`, since `native6` carries a frequency and no
  table.
- Wire obs4REF through the solver and catalog. ESMValTool reference is
  dispatch-only for now, matching its provenance-first use case.
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