Skip to main content

Production-ready climate diagnostics tools with advanced chunking optimization for analyzing and visualizing climate data

Project description

Climate Diagnostics Toolkit

Documentation Python Version License Version Status GitHub Actions Issues GitHub Stars

A Python toolkit for analyzing, processing, and visualizing climate data from model output, reanalysis, and observations. Built on xarray, it provides specialized accessors for time series analysis, trend calculations, and spatial diagnostics with chunking optimization and parallel processing support.

Version 1.3.0 - Features a refactored architecture with centralized data processing, enhanced exception handling, and optimized performance for scientific computing workflows.

Table of Contents

Key Features

  • Production-Ready Architecture: Centralized data processing pipeline with robust exception handling and optimized performance.
  • xarray Integration: Access features via .climate_plots, .climate_timeseries, and .climate_trends accessors on xarray Datasets.
  • Chunking Optimization: Memory-efficient chunking strategies for large datasets.
  • Enhanced Reliability: Specific exception handling provides clear error messages and improved debugging experience.
  • Temporal Analysis: Trend detection, STL decomposition, and variability analysis.
  • Spatial Visualization: Map plotting with Cartopy and custom projections.
  • Statistical Diagnostics: Climate science methods including ETCCDI indices.
  • Radiative Equilibrium Models: Functions for simulating radiative and radiative-convective equilibrium.
  • Multi-model Analysis: Compare and evaluate climate model outputs.
  • Performance: Dask-powered parallel processing for large datasets.

Installation

With pip (from PyPI)

pip install climate_diagnostics

With pip (from source)

For the latest development version:

git clone https://github.com/pranay-chakraborty/climate_diagnostics.git
cd climate_diagnostics
pip install -e .

With conda

If you prefer to manage your environment with conda, you can use the provided environment.yml file:

conda env create -f environment.yml
conda activate climate-diagnostics
pip install -e .

Quick Start

This example demonstrates a typical workflow for analyzing and visualizing climate data using this toolkit.

import xarray as xr
from climate_diagnostics import accessors
from climate_diagnostics.models.rce import create_rce_model

# 1. Load a dataset
ds = xr.tutorial.load_dataset("air_temperature")

# 2. Calculate and plot spatial trends with a custom projection
trends = ds.climate_trends.calculate_spatial_trends(
    variable="air",
    frequency="Y",  # Annual trends
    projection="Robinson"
)

# 3. Plot the mean temperature for a specific season
fig = ds.climate_plots.plot_mean(
    variable="air", 
    season="JJA", 
    title="Mean Summer (JJA) Temperature"
)

# 4. Run a single-column Radiative-Convective Equilibrium (RCE) model
rce_model = create_rce_model(integrate_years=2)

API Overview

Accessors

  • climate_plots: Geographic and statistical visualizations including:
    • plot_mean(), plot_std(), plot_percentile()
    • plot_prcptot(), plot_sdii(), plot_days_above_threshold()
    • plot_cdd(), plot_wsdi(), plot_csdi()
  • climate_timeseries: Time series analysis and decomposition:
    • plot_time_series(), plot_std_space()
    • decompose_time_series()
  • climate_trends: Trend calculation and significance testing:
    • calculate_trend(), calculate_spatial_trends()

Models

  • create_rce_model(): Simulate radiative-convective equilibrium
  • create_re_model(): Simulate pure radiative equilibrium

Example: Time Series Analysis

# Decompose a time series into trend and seasonal components
decomposition = ds.climate_timeseries.decompose_time_series(
    variable="air",
    latitude=slice(30, 40),
    longitude=slice(-100, -90)
)

Documentation

Complete Documentation

Local Documentation Build

To build and view documentation locally:

cd docs
make html
# Open build/html/index.html in your browser

Contributing & Support

Development & Testing

git clone https://github.com/pranay-chakraborty/climate_diagnostics.git
cd climate_diagnostics
conda env create -f environment.yml
conda activate climate-diagnostics
pip install -e ".[dev]"
pytest

License

This project is licensed under the MIT LICENSE.

Citation

If you use Climate Diagnostics Toolkit in your research, please cite:

Chakraborty, P. (2025) & Muhammed I. K., A. (2025). Climate Diagnostics Toolkit: Tools for analyzing and visualizing climate data using xarray accessors. Version 1.3.0. https://github.com/pranay-chakraborty/climate_diagnostics

For LaTeX users:

@software{chakraborty2025climate,
  author = {Chakraborty, Pranay and Muhammed I. K., Adil},
  title = {{Climate Diagnostics Toolkit: Tools for analyzing and visualizing climate data using xarray accessors}},
  year = {2025},
  version = {1.3.0},
  publisher = {GitHub},
  url = {https://github.com/pranay-chakraborty/climate_diagnostics},
  note = {[Computer software]}
}

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_diagnostics-1.3.0.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

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

climate_diagnostics-1.3.0-py3-none-any.whl (44.6 kB view details)

Uploaded Python 3

File details

Details for the file climate_diagnostics-1.3.0.tar.gz.

File metadata

  • Download URL: climate_diagnostics-1.3.0.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for climate_diagnostics-1.3.0.tar.gz
Algorithm Hash digest
SHA256 1335311bf142cbd2f6b8425ad1c69e5efb306661cff40f4bf478128fb54f23e6
MD5 5cc4d650a216eedfcd193200022b86ff
BLAKE2b-256 86d5912fd72ecfbb723967b9e96e5138e703993bf7150453e08c461bd73a2e41

See more details on using hashes here.

File details

Details for the file climate_diagnostics-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for climate_diagnostics-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 96562b73507ee854f6f4bd05197fb73701ceb8060ac82ff7d64a66d291133944
MD5 ac6d4ec214849457e6efb1f6114eae66
BLAKE2b-256 aab1624dda312b96cbbd427cce3ddfa234c6b2b1e0dbd772c0b2a33fa9eb1912

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