Repository navigation
feat(processes): population-weighted aggregation to features - #28
Merged
Merged
Conversation
An openEO process, aggregate_spatial_population_weighted, and the aggregate_population_weighted_chap workflow, moved here from the Sri Lanka and Salvador instances so any instance can install them. Named apart from core's area-weighted aggregate_spatial_weighted, which the instance copies used to shadow.
Only the process moves here for now; the workflow that saves Chap CSV stays with the instances that use it.
There was a problem hiding this comment.
🟡 Changes recommended
Population resampling and grid-order handling can produce incorrect aggregation results.
3 open issues
What changed in this PR
Adds a reusable population-weighted aggregation process to OCS plugins, using a distinct name to avoid replacing core’s area-weighted process.
Changes:
- Introduces per-feature, per-time-step population-weighted means.
- Tests process discovery, weighted calculations, and missing values.
- Documents process availability and aggregation behavior.
| File | Description |
|---|---|
| tests/test_population_weighted.py | Tests discovery and aggregation behavior. |
| README.md | Documents the process and grid-resolution guidance. |
| ocs_plugins/processes/aggregate_spatial_population_weighted.py | Implements population-weighted aggregation. |
| ocs_plugins/processes/__init__.py | Adds the processes package. |
| ocs_plugins/__init__.py | Updates the package docstring to mention processes. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Adds the package's first openEO process,
aggregate_spatial_population_weighted: the population-weighted mean of a raster per feature and time step,sum(value × population) / sum(population), with a population raster such as WorldPop asweights.It is moved unchanged from the Sri Lanka and Salvador instances, so any instance can install it; the workflow that saves Chap CSV stays in those instances for now. The process is renamed from
aggregate_spatial_weighted: under that name it replaced OCS core's area-weighted process, which takes different arguments, so core workflows such asaggregate_by_featuresfailed on those instances.It counts a cell when its centre is inside the feature, unlike core's coverage-weighted aggregation. The README says so, and that the population raster should be much finer than the smallest feature.
Tests: discovery through the entry point, the weighted mean against a hand-computed value, and cells with no data or no people left out, with a feature without any getting no value rather than 0.