Skip to main content

Example diagnostic provider for the Rapid Evaluation Framework

Project description

climate-ref-example

PyPI version Documentation Status License Python Version

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

climate_ref_example-0.14.5.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

climate_ref_example-0.14.5-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file climate_ref_example-0.14.5.tar.gz.

File metadata

  • Download URL: climate_ref_example-0.14.5.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for climate_ref_example-0.14.5.tar.gz
Algorithm Hash digest
SHA256 beb6dd79052cb3853c4d810d1924220f8be67f3f3dc1969373a3c2b48e3a9138
MD5 14cded34c00e90ab177d18a3e10b0af9
BLAKE2b-256 1276f420a0a22bf1261a762efaf5cef8dbe696603decce44b04419ca0f2d8aa5

See more details on using hashes here.

File details

Details for the file climate_ref_example-0.14.5-py3-none-any.whl.

File metadata

  • Download URL: climate_ref_example-0.14.5-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for climate_ref_example-0.14.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8a47a426c175a8f302f0a8ea237f34f4b1737553c7448246ea8e573426fd81ab
MD5 bab5d2b958beedb19145699e0de0f3b9
BLAKE2b-256 38f2acd1ac0c417c89deba32df1c48861ed36f71b6a17155a16d59da8dc59f15

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page