Skip to content

Climate Toolkit

Location-based climate analysis for agriculture: fetch daily climate data, compute seasonal climatologies and drought indices, assess crop and livestock hazards, and compare periods, data sources, and weather stations — for any point location.

Email Pete to subscribe for a short note with each stable release, including changes that may affect your code or results. Reply “unsubscribe” to leave.

Try it in your browser — no install

Open In Colab

The companion Colab notebook installs the package and runs the credential-free examples end-to-end on a free Google-hosted runtime.

Install

pip install climate-toolkit

Quick start

import climate_toolkit as ct
from datetime import date

df = ct.fetch_climate_data(
    source="nasa_power",              # needs no credentials
    location_coord=(-1.286, 36.817),  # Nairobi
    date_from=date(2020, 1, 1),
    date_to=date(2020, 12, 31),
)
df.head()

nasa_power works with zero setup. For CHIRPS v3 rainfall and CHIRTS-ERA5 daily temperatures, use direct cloud access on Python 3.12+ with climate-toolkit[cloud]. For ERA5-Land, ERA5 and NEX-GDDP, follow Earth Engine setup.

What's in the box

Function Purpose
fetch_climate_data Daily climate data for a site as a pandas DataFrame
analyze_climate_statistics Seasonal climatology, water balance, SPI/SPEI
evaluate_hazards Crop & livestock hazard assessment for a season
compare_climate_periods Focal year vs. baseline climatology
compare_climate_sources Side-by-side gridded dataset comparison
download_station_data Daily observations from nearby weather stations
compare_station_to_grids Validate gridded data against stations

These seven analyses also have CLI commands. The Python API overview includes run_pipeline for running a whole workflow and backend_policy for controlling data access.

Funding & acknowledgements

This toolkit was developed as part of the project Advancing Climate Data Integration in Agroecological Research, funded by the McKnight Foundation through its Global Collaboration for Resilient Food Systems (CRFS) programme. The work was led by the Alliance of Bioversity International and CIAT, in partnership with AIMS Research and Innovation Centre (AIMS RIC).

This work was supported by the CGIAR Climate Action Program through its Area of Work 1 (AoW1) — the Climate Data Hub (CDH), which funds and coordinates the climate-data infrastructure this toolkit is part of. We acknowledge the CGIAR Trust Fund and its contributors.

The McKnight Foundation CGIAR Climate Action AIMS Research and Innovation Centre (AIMS RIC)