climate-ref-example
This package provides an example implementation of a diagnostic provider for the Climate REF (Rapid Evaluation Framework). It serves as a template and reference for developers who want to create their own diagnostic providers.
Installation
pip install climate-ref-example
Features
- Example implementation of a diagnostic provider
- Global mean timeseries diagnostic demonstration
- Complete implementation of all required interfaces
- Test data specification for reproducible testing
Usage
Enable the provider in your ref.toml configuration:
[[diagnostic_providers]]
provider = "climate_ref_example:provider"
Then run diagnostics:
ref solve --provider example
Example Diagnostic
The package implements a GlobalMeanTimeseries diagnostic that calculates the annual mean global mean timeseries for CMIP6 datasets:
from climate_ref_core.providers import DiagnosticProvider
from climate_ref_core.diagnostics import Diagnostic, DataRequirement, ExecutionDefinition, ExecutionResult
from climate_ref_core.datasets import FacetFilter, SourceDatasetType
class GlobalMeanTimeseries(Diagnostic):
"""Calculate the annual mean global mean timeseries for a dataset."""
name = "Global Mean Timeseries"
slug = "global-mean-timeseries"
data_requirements = (
DataRequirement(
source_type=SourceDatasetType.CMIP6,
filters=(FacetFilter(facets={"variable_id": ("tas", "rsut")}),),
group_by=("source_id", "variable_id", "experiment_id", "variant_label"),
),
)
facets = ("source_id", "variable_id", "experiment_id", "variant_label", "region", "metric", "statistic")
def execute(self, definition: ExecutionDefinition) -> None:
# Perform the diagnostic calculation
...
def build_execution_result(self, definition: ExecutionDefinition) -> ExecutionResult:
# Build and return the execution result
...
# Register diagnostics with a provider
provider = DiagnosticProvider("Example", __version__)
provider.register(GlobalMeanTimeseries())
Creating Your Own Provider
Use this package as a template:
cp -r packages/climate-ref-example packages/climate-ref-myprovider
See the Adding Custom Diagnostics guide for detailed instructions.
Documentation
For detailed documentation, please visit https://climate-ref.readthedocs.io/
Contributing
Contributions are welcome! Please see the main project's Contributing Guide for more information.
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Metadata
Release files for climate-ref-example 0.17.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| climate_ref_example-0.17.2.tar.gz | 24.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| climate_ref_example-0.17.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 39.9 kB
Release files / climate_ref_example-0.17.2.tar.gz
| Download URL | climate_ref_example-0.17.2.tar.gz |
|---|---|
| Size | 24.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0883878530964798a6178db9e9ab7e8111225e41d7f0e1bd8926d9bb19ee430b
|
|
BLAKE2b-256 checksum How to use checksums |
8f81ef74184ece798dbee3dcfb4c779a68547acc6ed37923004a1b40e40a753c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / climate_ref_example-0.17.2-py3-none-any.whl
| Download URL | climate_ref_example-0.17.2-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bdba9262715838730cfcce0d92f7a48d8cf81c17f7d68a62419ef97efb8d50f8
|
|
BLAKE2b-256 checksum How to use checksums |
f8d83fda5bd4d3c23dab1306e69bbefe476b61a5138bbbb3f1971bfceeadef3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|