Skip to content

Climate Data Integration

This document describes the architecture for integrating climate and population raster data into DHIS2 using the prefect-climate package.

Supported data sources

Source Package module Resolution Variables
WorldPop prefect_climate.worldpop ~100 m Population (sex, age)
ERA5-Land prefect_climate.era5 ~9 km Temperature, precipitation, humidity, wind speed, skin temperature, solar radiation, soil moisture
CHIRPS prefect_climate.chirps ~5 km Precipitation
yr.no prefect_climate.yr Point-based Temperature, precipitation, humidity, wind speed, cloud cover, air pressure (forecast)
Open-Meteo Historical prefect_climate.openmeteo Point-based Temperature, precipitation, humidity, wind speed, cloud cover, air pressure (1940--present)
Open-Meteo Forecast prefect_climate.openmeteo Point-based Temperature, precipitation, humidity, wind speed, cloud cover, air pressure (16-day forecast)
Open-Meteo Air Quality prefect_climate.openmeteo Point-based PM2.5, PM10, ozone, NO2, SO2, CO, European AQI

Architecture

prefect-climate/
    prefect_climate/
        schemas.py        # Shared models: ImportQuery, ClimateQuery, etc.
        zonal.py          # Zonal stats: zonal_sum, zonal_mean, bounding_box
        worldpop/         # WorldPop GeoTIFF download + population stats
        era5/             # ERA5-Land via earthkit-data + CDS API
        chirps/           # CHIRPS v3.0 global daily precipitation
        yr/               # yr.no Locationforecast point-based weather forecasts
        openmeteo/        # Open-Meteo historical weather, forecast, and air quality

Zonal statistics

The zonal.py module provides two core operations:

  • zonal_sum -- used for population rasters where pixel values are counts that should be summed within a boundary
  • zonal_mean -- used for climate rasters (temperature, rainfall) where the spatial average is meaningful

Both functions use rioxarray to clip a GeoTIFF to a GeoJSON polygon and compute the statistic while handling nodata values.

Flow pattern

All import flows follow the same structure:

  1. ensure_dhis2_metadata -- Create/update DHIS2 data elements, data sets, and (optionally) category combos. All metadata objects include a sharing property: data sets default to rwrw---- (metadata read/write, data read/write) so imported data is publicly visible and accessible in data entry; data elements default to rw------ (metadata read/write only, as DHIS2 does not support data-level sharing on data elements).
  2. Download rasters -- Fetch data from the source (CDS API, HTTP, etc.)
  3. Compute zonal stats -- One task per org unit
  4. Build data values -- Convert results to DHIS2 DataValueSet format
  5. Import to DHIS2 -- POST data values and report summary

Period handling

Data type Period format Example
Population (yearly) YYYY 2024
Climate (monthly) YYYYMM 202401
Weather forecast (daily) YYYYMMDD 20240115

ENACTS

ENACTS (Enhancing National Climate Services) is a climate data initiative by the International Research Institute for Climate and Society (IRI) at Columbia University. It produces high-resolution, quality-controlled climate datasets by blending:

  • Weather station observations (national meteorological services)
  • Satellite estimates (CHIRPS for rainfall, various products for temperature)
  • Reanalysis data (ERA5 for temperature)

ENACTS datasets are typically produced per country in collaboration with national meteorological agencies, providing better accuracy than global products alone in data-sparse regions. The output is gridded data at resolutions typically matching or exceeding the input satellite products (~5 km for rainfall, ~9 km for temperature).

ENACTS products include:

Product Resolution Period
Rainfall ~5 km (dekadal, monthly) 1981 -- present
Temperature (min/max/mean) ~9 km (dekadal, monthly) 1981 -- present

ENACTS is available for 30+ African countries through the IRI Data Library. Integration with this pipeline would follow the same pattern: download rasters, compute zonal stats, import to DHIS2. The existing zonal_mean function works directly with ENACTS GeoTIFFs.

DHIS2 Climate Tools ecosystem

This pipeline aligns with the DHIS2 Climate Tools ecosystem:

Tool Role
earthkit-data Download climate data from CDS
earthkit-transform Aggregate to org unit boundaries
dhis2eo Earth observation data operations
xarray / rioxarray Multi-dimensional array processing
geopandas Geospatial analysis

The prefect-climate package replaces the need for dhis2eo by providing the same download-aggregate-import workflow as Prefect tasks with built-in orchestration, retries, and observability.

References