Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Downloading Climate Data from CHIRPS v3

In this notebook we demonstrate how to fetch CHIRPS v3 daily precipitation for a DHIS2 organisation unit level, download only the needed spatial bounding box, and return an xarray object (ready for aggregation/analytics in a later step).

This notebook mirrors the ERA5-Land download flow, but uses CHIRPS v3 GeoTIFFs and raster window reads (no full global load).


Import libraries

We start by importing the necessary libraries:

import json
import geopandas as gpd

from dhis2eo.data.chc import chirps3

Load organisation units

Load organisation units for Sierra Leone. The resulting GeoDataFrame is used to derive a bounding box.

org_units = gpd.read_file('../../data/sierra-leone-districts.geojson')
org_units
Loading...

Download CHIRPS v3 daily precipitation for the org unit bounding box

CHIRPS v3 data is provided at the daily level. We define the start and end parameters to only get precipitation data between the 1st and 7th July, and set the bounding box (bbox) to only get data for the spatial extent of the org units:

# Choose a date range (inclusive)
start = "2025-07-01"
end = "2025-07-07"

ds = chirps3.daily.get(start=start, end=end, bbox=org_units.total_bounds)
dhis2eo.data.utils - INFO - Loading from cache: C:\Users\karimba\AppData\Local\Temp\dhis2eo_data_chc_chirps3_daily_get_b67190aa52.nc

If we inspect the contents of the downloaded dataset, we see that the main variable is precipitation (precip), and contains data for 7 days on the time dimension:

ds
Loading...