Skip to main content

Climate indices computation package based on Xarray.

Project description

Versions

Python Package Index Build Conda-forge Build Version Supported Python Versions

Documentation and Support

Documentation Status Static Badge

Open Source

License Open Source Security Foundation Scorecard DOI pyOpenSci JOSS

Coding Standards

Ruff pre-commit.ci status Open Source Security Foundation Best Practices FOSSA

Development Status

Project Status: Active – The project has reached a stable, usable state and is being actively developed. Build Status Coveralls

xclim is an operational Python library for climate services, providing numerous climate-related indicator tools with an extensible framework for constructing custom climate indicators, statistical downscaling and bias adjustment of climate model simulations, as well as climate model ensemble analysis tools.

xclim is built using xarray and can seamlessly benefit from the parallelization handling provided by dask. Its objective is to make it as simple as possible for users to perform typical climate services data treatment workflows. Leveraging xarray and dask, users can easily bias-adjust climate simulations over large spatial domains or compute indices from large climate datasets.

For example, the following would compute monthly mean temperature from daily mean temperature:

import xclim
import xarray as xr

ds = xr.open_dataset(filename)
tg = xclim.atmos.tg_mean(ds.tas, freq="MS")

For applications where metadata and missing values are important to get right, xclim provides a class for each index that validates inputs, checks for missing values, converts units and assigns metadata attributes to the output. This also provides a mechanism for users to customize the indices to their own specifications and preferences. xclim currently provides over 150 indices related to mean, minimum and maximum daily temperature, daily precipitation, streamflow and sea ice concentration, numerous bias-adjustment algorithms, as well as a dedicated module for ensemble analysis.

Quick Install

xclim can be installed from PyPI:

$ pip install xclim

or from Anaconda (conda-forge):

$ conda install -c conda-forge xclim

Documentation

The official documentation is at https://xclim.readthedocs.io/

How to make the most of xclim: Basic Usage Examples and In-Depth Examples.

Conventions

In order to provide a coherent interface, xclim tries to follow different sets of conventions. In particular, input data should follow the CF conventions whenever possible for variable attributes. Variable names are usually the ones used in CMIP6, when they exist.

However, xclim will always assume the temporal coordinate is named “time”. If your data uses another name (for example: “T”), you can rename the variable with:

ds = ds.rename(T="time")

xclim employs a black-compatible code formatting style (via a modified ruff configuration) and (mostly) adheres to the NumPy docstring style. For more information on coding and development conventions, see the Contributing Guidelines.

Contributing to xclim

xclim is in active development and is being used in production by climate services specialists around the world.

  • If you’re interested in participating in the development of xclim by suggesting new features, new indices or report bugs, please leave us a message on the issue tracker.
    • If you have a support/usage question or would like to translate xclim to a new language, be sure to check out the existing Static Badge first!

  • If you would like to contribute code or documentation (which is greatly appreciated!), check out the Contributing Guidelines before you begin!

How to cite this library

If you wish to cite xclim in a research publication, we kindly ask that you refer to our article published in The Journal of Open Source Software (JOSS): https://doi.org/10.21105/joss.05415

To cite a specific version of xclim, the bibliographical reference information can be found through Zenodo

License

This is free software: you can redistribute it and/or modify it under the terms of the Apache License 2.0. A copy of this license is provided in the code repository (LICENSE).

Energy and Carbon Usage

The xclim development team is interested in thoroughly testing our software while also reducing the environmental impact of the software we develop. This repository uses the ECO-CI tool to estimate and track the energy use and carbon emissions of our continuous integration workflows.

ECO-CI Energy Use and Carbon Emissions from CI Workflows (since November 2024)

Testing suite

(main branch)

Energy Usage

Energy Consumption (Last run) Energy Consumption (Last 90 days moving average) Energy Consumption (Total)

Carbon Emissions

Carbon Emissions (Last run) Carbon Emissions (Last 90 days moving average) Carbon Emissions (Total)

Credits

xclim development is funded through Ouranos, Environment and Climate Change Canada (ECCC), the Fonds vert and the Fonds d’électrification et de changements climatiques (FECC), the Canadian Foundation for Innovation (CFI), and the Fonds de recherche du Québec (FRQ).

This package was created with Cookiecutter and the audreyfeldroy/cookiecutter-pypackage project template.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

xclim-0.59.0.tar.gz (883.3 kB view details)

Uploaded Source

Built Distribution

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

xclim-0.59.0-py3-none-any.whl (379.0 kB view details)

Uploaded Python 3

File details

Details for the file xclim-0.59.0.tar.gz.

File metadata

  • Download URL: xclim-0.59.0.tar.gz
  • Upload date:
  • Size: 883.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xclim-0.59.0.tar.gz
Algorithm Hash digest
SHA256 e3ae6bcd63fbe272f3719fdb22c9b1d6eff7c3a44265716a24f1be2a4efe3ceb
MD5 27d8201b0883380a26a3fb282f5d192e
BLAKE2b-256 4755f21e9d478ffc363661c8e7f77906d4a6b29aadc0ca10852189e8bf2cd76b

See more details on using hashes here.

Provenance

The following attestation bundles were made for xclim-0.59.0.tar.gz:

Publisher: publish-pypi.yml on Ouranosinc/xclim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xclim-0.59.0-py3-none-any.whl.

File metadata

  • Download URL: xclim-0.59.0-py3-none-any.whl
  • Upload date:
  • Size: 379.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xclim-0.59.0-py3-none-any.whl
Algorithm Hash digest
SHA256 06745169e9803a6c628fc4c8470890c96a4867b857764236f22eb48f4eb77c20
MD5 5f5d3a5d0cd5b57c5e8a393816895ef5
BLAKE2b-256 b355d2302e0ca616c89525dc9875dfd6d76d331161899e0a703800bc3a3c5feb

See more details on using hashes here.

Provenance

The following attestation bundles were made for xclim-0.59.0-py3-none-any.whl:

Publisher: publish-pypi.yml on Ouranosinc/xclim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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