climate_ref_core.reference_data
#
What reference data the diagnostics need, and which collection supplies it.
A deployment draws its observational data from several places:
the obs4REF registry, the obs4MIPs archive on ESGF, and the provider registries (PMP climatology, ILAMB).
Which of them supplies a given dataset is not stated anywhere the user can read,
so the answer has had to be reconstructed by hand from the providers' data requirements.
This module works it out once, so that the documentation and ref doctor agree.
Provenance is resolved per source_id rather than per variable. A registry either carries
a dataset or it does not, and asking whether a specific (source_id, variable_id) pair
exists is a question only the archive can answer: ESGF intersects its facets, so a requirement
naming four sources and eight variables does not imply all thirty-two combinations exist.
ESGF_OBS4MIPS = 'ESGF obs4MIPs'
module-attribute
#
Supplier used for reference data that no registry carries.
UNKNOWN_SUPPLIER = 'unknown'
module-attribute
#
Supplier used when a required dataset is in no registry and no archive is known to hold it.
ReferenceDataset
#
A reference dataset the enabled diagnostics require, and where it comes from.
Source code in packages/climate-ref-core/src/climate_ref_core/reference_data.py
diagnostics
instance-attribute
#
The diagnostics that require it, sorted by provider then name.
is_from_registry
property
#
Whether a ref datasets fetch-data call can retrieve this dataset.
registry_name
instance-attribute
#
The registry that carries it, or None when it has to be fetched from ESGF.
source_id
instance-attribute
#
The dataset's source_id.
source_type
instance-attribute
#
Value of the source type the requirement asks for, e.g. obs4mips.
supplier
property
#
Where the dataset comes from: a registry name, ESGF_OBS4MIPS, or UNKNOWN_SUPPLIER.
variable_ids
instance-attribute
#
Every variable the diagnostics ask this dataset for.
This is the union across requirements, not a claim that the dataset publishes each one.
collect_required_reference_data(providers, manager=None)
#
Work out every reference dataset the given providers' diagnostics require.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
providers
|
Iterable[DiagnosticProvider]
|
The diagnostic providers to inspect. |
required |
manager
|
DatasetRegistryManager | None
|
Registry manager used to resolve where each dataset comes from. |
None
|
Returns:
| Type | Description |
|---|---|
list[ReferenceDataset]
|
One entry per (source type, source_id), sorted by source type then source_id. |
Source code in packages/climate-ref-core/src/climate_ref_core/reference_data.py
format_reference_data_markdown(datasets)
#
Render the required reference data as a markdown page.
Returns:
| Type | Description |
|---|---|
str
|
Markdown, one table per supplier. |
Source code in packages/climate-ref-core/src/climate_ref_core/reference_data.py
source_ids_by_registry(manager=None)
#
Map each dataset a reference registry carries to the registries that carry it.
Keyed on (source type, source_id) rather than source_id alone: a registry only
supplies a dataset for the source type it is registered against, so the ERA-5 climatology
in the PMP registry does not satisfy a requirement for obs4MIPs ERA-5.
Registries whose keys do not encode a source_id are skipped: their contents cannot be
matched to a data requirement this way, and are fetched by the provider instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manager
|
DatasetRegistryManager | None
|
Registry manager to read. Defaults to the process-wide one. |
None
|
Returns:
| Type | Description |
|---|---|
dict[tuple[str, str], list[str]]
|
Mapping of (source type value, |