Skip to main content

Climate diagnostics tools for analyzing and visualizing climate data

Project description

Climate Diagnostics Toolkit

Python Version License Version Status PyPI version

A Python package for analyzing and visualizing climate data and running simple climate models, integrated directly with xarray.

Overview

The Climate Diagnostics Toolkit provides powerful tools to process, analyze, and visualize climate data using xarray accessors, and to create, run, and analyze a hierarchy of well-established simple climate models using climlab. The package offers functionality for seasonal filtering, spatial averaging, trend analysis, time series decomposition, and creating instances of models ranging from simple Energy Balance Models (EBMs) to Radiative-Convective Models (RCMs) with multi-band radiation schemes.

Features

  • Data Analysis with xarray Accessors:

    • Access analysis functions via .climate_timeseries, .climate_trends, and .climate_plots on your xarray.Dataset objects.
    • Filter data by meteorological seasons, and select spatial and temporal domains.
    • Decompose time series using STL and compute robust spatial trends with Dask for parallelization.
    • Generate publication-quality spatial maps with Cartopy.
  • Climate Model Hierarchy (via .models submodule):

    • Create, configure, and run a suite of classic climate models from the climlab library.
    • The submodule provides simple creator functions for complex models, making it easy to get started with climate modeling.
    • Implemented models include:
      • Energy Balance Model (EBM): create_ebm_model() - A latitudinally-dependent model for studying ice-albedo feedback and heat transport.
      • Boltzmann EBM: create_boltzmann_ebm_model() - An EBM using the fundamental Stefan-Boltzmann law for outgoing radiation.
      • Radiative-Convective Equilibrium (RCE): create_rce_model() - A single-column model using the sophisticated CAM3 radiation scheme to study atmospheric equilibrium.
      • Grey Gas RCM: create_grey_gas_model() - A classic RCM that represents the greenhouse effect with a single atmospheric optical depth.
      • Band RCM: create_band_rcm_model() - An advanced column model with a multi-band radiation scheme for CO2, O3, and H2O.

Installation

pip install climate-diagnostics

Usage Examples

Analyzing Trends

import xarray as xr
# The accessors are registered automatically on import
import climate_diagnostics

# Load data
ds = xr.open_dataset("path/to/climate_data.nc")

# Calculate and plot spatial trends per decade
spatial_trends = ds.climate_trends.calculate_spatial_trends(
    variable="air",
    level=850,
    season="annual",
    num_years=10,  # Trend per decade
)

Creating and Running a Climate Model

from climate_diagnostics import models

# Create an Energy Balance Model with a slightly lower ice albedo
ebm = models.create_ebm_model(ai=0.55)

# Integrate the model for 5 years
ebm.integrate_years(5)

# You can now access the model's state, e.g., the surface temperature
print(ebm.Ts)

# All models are climlab objects, so you can use climlab's tools for analysis
# For example, let's create a Radiative-Convective model and check its equilibrium
rce = models.create_rce_model(water_depth=10)
rce.integrate_years(2)
print(rce.ASR - rce.OLR) # Check the energy balance

Dependencies

  • xarray
  • dask
  • netCDF4
  • bottleneck
  • matplotlib
  • numpy
  • scipy
  • cartopy
  • statsmodels
  • climlab

Development

git clone https://github.com/pranay-chakraborty/climate_diagnostics.git
cd climate_diagnostics
# Set up environment (conda recommended)
pip install -e ".[dev]"

License

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.0.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.0.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.0.0.tar.gz (39.4 kB 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.0.0-py3-none-any.whl (40.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: climate_diagnostics-1.0.0.tar.gz
  • Upload date:
  • Size: 39.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for climate_diagnostics-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4a5612fe19dfe0a482a83fd7c32605ab7fdea76a70ecb31d7682ae3c363c360a
MD5 361b02d376c4fd501d43b7b9d1d419d4
BLAKE2b-256 fc27fd8063fd75319f4570201c10be583e149a46fcfe78516833f38aa6fbcbb1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for climate_diagnostics-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8293dde5176c4268965c345f5473a95e2cd23efc29244d0800cb67f20cb1af1e
MD5 f65b3d475b07c7d82ff405998695f3c9
BLAKE2b-256 8a470649347b7de9ad5c412970615129adb9bba7cc055286af4d110afd1ddcaa

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