Skip to main content

Tools for calculating climate indicies, climate change analysis and attribution.

Project description

ECMWF Software EnginE Maturity Level Licence Latest Release

Quick StartDocumentation

[!IMPORTANT] This software is Emerging and subject to ECMWF's guidelines on Software Maturity.

earthkit-climate

earthkit-climate is the package responsible for the climate index calculation within the earthkit ecosystem. It includes a wrapper prototype that allows the use of the xclim python package to compute a large amount of pre-defined climate indices used by the climate science community, and to define new ones.

xclim relies heavily on the xarray python library and the numpy & scipy ecosystem. Its main elements are:

  • Climate indices: available to be directly computed with python functions. The input and output units are defined in these functions by using a decorator and are validated during runtime.
  • Climate indicators: climate indices wrapped in an object that provides more metadata and validation facilities (health checks) of the input. it includes attributes for CF metadata (cell methods), references, keywords, and more.
  • Lower level process functions: these include aggregation, computation spell length and counting, optimized computation of reference percentiles, bias correction methods and ensemble statistics. These functions are used by the implemented indices and can also be used to build new indices not included in the library.

Disclaimer

This project is currently in BETA and experimental. Interfaces, structure, and functionality are subject to change without notice. Do not use this software in any operational or production system.


Quick Start

Install the package in editable mode:

pip install -e .

Example usage:

from earthkit.climate.indicators import precipitation, temperature
from earthkit.climate.utils import conversions

# Example: compute a precipitation index
pr = precipitation.simple_daily_intensity(precip_data, freq="monthly")

Documentation

For full documentation, including API reference and example notebooks, visit the earthkit-climate ReadTheDocs page


Development & Contribution Workflow

1. Setup environment (with Pixi)

This project uses Pixi for dependency and environment management. It provides fast, reproducible environments and replaces Conda-based workflows.

Install Pixi following the official instructions, then run:

pixi install

This command installs all dependencies as defined in pyproject.toml and pixi.lock.

2. Common Tasks

This project uses pixi tasks to manage development workflows, replacing the legacy Makefile.

  • Quality Assurance: Run pre-commit hooks to ensure code quality.

    pixi run -e dev qa
    
  • Unit Tests: Run the test suite using pytest.

    pixi run -e dev unit-tests
    
  • Type Checking: Run static type analysis with mypy.

    pixi run -e dev type-check
    
  • Build Documentation: Build the Sphinx documentation. Note that this task runs in the docs environment.

    pixi run -e docs docs-build
    
  • Docker: Build and run the docker container.

    pixi run docker-build
    pixi run docker-run
    
  • Sync with ECMWF template:

    pixi run template-update
    

Project Structure

earthkit-climate/
├── src/earthkit/
│   ├── climate/
│   │   ├── api/               # API wrapper logic
│   │   ├── indicators/        # Climate indices (precipitation, temperature, etc.)
│   │   └── utils/             # Type conversions, percentiles, provenance
│   └── __init__.py
├── tests/
│   ├── unit/                  # Unit tests for indicators and utils
│   └── test_00_version.py     # Version check
├── docs/                      # Sphinx documentation
├── ci/                        # Continuous integration configs
├── .github/workflows/         # GitHub Actions (push/release)
├── .pixi/                     # Pixi configuration
├── pixi.lock                  # Locked dependency versions
├── Dockerfile                 # Pixi-based container
├── pyproject.toml             # Project configuration
└── README.md

License

Copyright 2022, European Centre for Medium Range Weather Forecasts.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

In applying this licence, ECMWF does not waive the privileges and immunities
granted to it by virtue of its status as an intergovernmental organisation
nor does it submit to any jurisdiction.

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

earthkit_climate-0.3.0.tar.gz (653.8 kB view details)

Uploaded Source

Built Distribution

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

earthkit_climate-0.3.0-py3-none-any.whl (34.0 kB view details)

Uploaded Python 3

File details

Details for the file earthkit_climate-0.3.0.tar.gz.

File metadata

  • Download URL: earthkit_climate-0.3.0.tar.gz
  • Upload date:
  • Size: 653.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for earthkit_climate-0.3.0.tar.gz
Algorithm Hash digest
SHA256 80d11f3eb3fbd2e3b3a65cfa17e3dd562f21a7916896939b6483b81cdfbfd641
MD5 6346a12d0432a6392859998234a6abf0
BLAKE2b-256 8e7d674ecc80a45e45f1f46dd4b5504dda45cb9cc62f978333683f6a8d73aca2

See more details on using hashes here.

File details

Details for the file earthkit_climate-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for earthkit_climate-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84395c7611b5f0b359c971e70bf3b08d1e4737d07fde4ee083760375b2861ac6
MD5 6505cd56e92a3824b7bfb3786e640590
BLAKE2b-256 c2145fedd66ce8055352928fe432332031bb9c7f4a3d718076488faa6c1c3385

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