Skip to content

Added raster temporal reduce process plugin#20

Open
karimbahgat wants to merge 2 commits intomainfrom
temporal-reduce-plugin
Open

Added raster temporal reduce process plugin#20
karimbahgat wants to merge 2 commits intomainfrom
temporal-reduce-plugin

Conversation

@karimbahgat
Copy link
Collaborator

@karimbahgat karimbahgat commented Feb 27, 2026

Just to check if it was easy to reuse components from datasets module to add a temporal reduce process, to perform temporal aggregation of a raster dataset to a given period. Just for testing purposes, the process returns a rendered map image of the reduced raster.

image

Example output for December 2025 and Brazil:

temporal_reduce_map

Performance and integration with tiling and org unit aggregation

Even when reducing ERA5-Land hourly temperature data to a full month of a very large country like Brazil, results are near instant (at least less than 1 second which includes rendering). Most countries should be much faster. A whole year for Sierra Leone was near instant.

This means that temporal aggregation is very fast and can be leveraged in a dynamic tiles endpoint, so that the time aggregated raster is generated for the whole country and saved to a temporary file on the fly (this is what should take <1s for all of Brazil and even faster for most countries, and can be cached for a short time), and then redirecting to TiTiler for dynamic tiles pointing to the time aggregated temporary file.

Can also be leveraged to do the temporal aggregation for many time periods prior to org unit aggregation. Already implemented separately in the FastAPI endpoint datasets/ID/PERIOD_TYPE/orgunits.

Reproducing

Make sure you sync your environment with the latest packages to install the necessary zarr Python package. To reproduce, follow these steps to download the data and build the zarr file using the /datasets endpoints (has not yet been integrated with the rest of the system):

  1. Download some data for the dataset 2m_temperature_hourly for the bbox extent of the level 2 org units in your connected DHIS2 instance (valid datasets defined in eo_api/datasets/registry, and actual file downloads end up in eo_api/datasets/cache/):
image
  1. Build a zarr archive for optimized access to the data.
image
  1. Trigger the temporal reduce process, eg with curl (this is Windows syntax and may need tweaking for other systems):
curl -X POST "http://localhost:8000/ogcapi/processes/temporal-reduce/execution" ^
-H "Content-Type: application/json" ^
-d "{\"inputs\": {\"raster\": \"2m_temperature_hourly\", \"band\": \"t2m\", \"period_type\": \"monthly\", \"time_period\": \"2025-12\", \"stats\": [\"mean\"]}}" ^
--output temporal_reduce_map.png

Eventually we want to merge this setup so we have a shared data registry and download folder including dataset-specific zarr archives for the whole system.

@karimbahgat karimbahgat marked this pull request as ready for review February 27, 2026 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant