climate_ref_core.summary
#
Utilities for extracting and formatting diagnostic/provider summaries.
This module provides structured summary data classes and functions for introspecting diagnostic providers, their diagnostics, and data requirements. Both CLI and documentation generation can reuse these utilities.
DataRequirementSummary
#
Summary of a single DataRequirement's filters and grouping.
Source code in packages/climate-ref-core/src/climate_ref_core/summary.py
DiagnosticReference
#
A reference to a diagnostic, linking name and slug to its provider.
Source code in packages/climate-ref-core/src/climate_ref_core/summary.py
DiagnosticSummary
#
Summary of a single diagnostic and its data requirements.
Source code in packages/climate-ref-core/src/climate_ref_core/summary.py
ExperimentSummaryTable
#
Summary of all variables required for a specific experiment.
Source code in packages/climate-ref-core/src/climate_ref_core/summary.py
ProviderSummary
#
Summary of a diagnostic provider and all its diagnostics.
Source code in packages/climate-ref-core/src/climate_ref_core/summary.py
RequirementSetSummary
#
Summary of one OR-alternative set of DataRequirements.
A diagnostic may have multiple requirement sets (OR-logic). Each set contains one or more DataRequirementSummary entries that must all be satisfied together (AND-logic within a set).
Source code in packages/climate-ref-core/src/climate_ref_core/summary.py
SourceTypeSummaryTable
#
Summary of all experiments and variables for a source type across providers.
Source code in packages/climate-ref-core/src/climate_ref_core/summary.py
VariableEntry
#
Summary of a variable's usage across diagnostics.
Source code in packages/climate-ref-core/src/climate_ref_core/summary.py
collect_by_source_type(providers)
#
Collect variables grouped by source type and experiment across all providers.
For each source type, produces experiments with their required variables and the diagnostics that need them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
providers
|
Iterable[DiagnosticProvider]
|
Iterable of DiagnosticProvider instances to aggregate. |
required |
Returns:
| Type | Description |
|---|---|
list[SourceTypeSummaryTable]
|
List of SourceTypeSummaryTable, sorted by source type name.
Within each source type, experiments are sorted alphabetically
(with |
Source code in packages/climate-ref-core/src/climate_ref_core/summary.py
collect_variables_by_experiment(providers)
#
Collect variables grouped by experiment and source type across providers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
providers
|
Iterable[DiagnosticProvider]
|
Iterable of DiagnosticProvider instances to aggregate. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, dict[str, set[str]]]
|
Nested dict: experiment -> source_type -> set of variable_ids.
Experiments with value |
Source code in packages/climate-ref-core/src/climate_ref_core/summary.py
format_diagnostic_markdown(summary)
#
Format a single diagnostic summary as a markdown section.
Uses admonitions for metadata and tabs for OR-logic options.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
summary
|
DiagnosticSummary
|
The DiagnosticSummary to format. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Markdown string describing the diagnostic. |
Source code in packages/climate-ref-core/src/climate_ref_core/summary.py
format_overview_markdown(tables)
#
Format source-type summary tables as a markdown page.
Produces a section per source type with sub-sections per experiment, each containing a table of variables and the diagnostics that need them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tables
|
list[SourceTypeSummaryTable]
|
List of SourceTypeSummaryTable to format. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Markdown string with tables grouped by source type and experiment. |
Source code in packages/climate-ref-core/src/climate_ref_core/summary.py
format_provider_markdown(summary)
#
Format a full provider summary as a markdown page.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
summary
|
ProviderSummary
|
The ProviderSummary to format. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Markdown string for the full provider page. |
Source code in packages/climate-ref-core/src/climate_ref_core/summary.py
summarize_data_requirement(req)
#
Create a summary of a single DataRequirement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
req
|
DataRequirement
|
The DataRequirement to summarize. |
required |
Returns:
| Type | Description |
|---|---|
DataRequirementSummary
|
A DataRequirementSummary with extracted facet values. |
Source code in packages/climate-ref-core/src/climate_ref_core/summary.py
summarize_diagnostic(diagnostic)
#
Create a summary of a diagnostic and its data requirements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
diagnostic
|
Diagnostic
|
The Diagnostic to summarize. |
required |
Returns:
| Type | Description |
|---|---|
DiagnosticSummary
|
A DiagnosticSummary with all requirement sets summarized. |
Source code in packages/climate-ref-core/src/climate_ref_core/summary.py
summarize_provider(provider)
#
Create a summary of a provider and all its diagnostics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
DiagnosticProvider
|
The DiagnosticProvider to summarize. |
required |
Returns:
| Type | Description |
|---|---|
ProviderSummary
|
A ProviderSummary with all diagnostics summarized. |