Skip to content

Conversation

@irm-codebase
Copy link

@irm-codebase irm-codebase commented Jul 16, 2025

This PR aims to improve the disaggregate_polygon_to_raster by removing the groupby normalisation operation, and instead rasterising the shapes and then performing the normalisation in a vectorised way.

The improvements significantly reduce the memory footprint, and allow 'larger than memory' cases to execute thanks to the "chunked" approach.

Here are two examples of the results on a 16 GB RAM laptop with an i7 13k core.
Please ignore the figure titles, I had a small bug that did not display the coarsened pixel count 😬

Key changes:

  • disaggregate_polygon_to_raster now expects a DataArray (not a Dataset). If a Dataset is given, it'll only process it if it contains one variable.
  • Added dask to the dependencies.

Proxy of all of Europe (estimated 'missing' PV rooftop capacity)

This case was previously impossible to run. Both RAM and Swap were filled, leading to a crash.
With dask, the memory footprint never exceeds the available memory capacity.

image rooftop_pv

Proxy of Montenegro

A smaller case that I was able to run in the previous approach.

Before

rooftop_pv (jann v0 0 2)

After

rooftop_pv

@jnnr jnnr mentioned this pull request Nov 12, 2025
2 tasks
@jnnr jnnr marked this pull request as draft November 14, 2025 17:25
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