Add raster-based dasymetric mapping module#936
Merged
brendancol merged 1 commit intomasterfrom Mar 4, 2026
Merged
Conversation
Adds disaggregate(), pycnophylactic(), and validate_disaggregation() for redistributing zone-level values onto finer raster grids. disaggregate supports three methods (binary, weighted, limiting_variable) across all four backends (numpy, cupy, dask+numpy, dask+cupy). pycnophylactic implements Tobler's smooth interpolation with iterative Laplacian smoothing and mass correction (numpy/cupy). validate_disaggregation checks that zone totals are preserved within tolerance across all backends. 51 tests covering known values, conservation, edge cases, cross-backend parity, and input validation.
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.
Closes #930.
Summary
disaggregate()for redistributing zone-level values (e.g. population per census tract) onto a finer raster grid using ancillary weights. Three methods:'binary','weighted','limiting_variable'. All four backends supported for binary/weighted; limiting_variable is numpy-only.pycnophylactic()implementing Tobler's (1979) smooth interpolation — iterative Laplacian smoothing with mass correction that preserves zone totals. Numpy and cupy (CPU fallback) supported; dask raisesNotImplementedErrorsince the algorithm is inherently iterative.validate_disaggregation()to check that zone totals in a result match the input values within tolerance. Works across all four backends..xrsfordisaggregateandpycnophylactic.Test plan
pytest xrspatial/tests/test_dasymetric.py -v— 51 tests passsum(result[zone]) == values[zone])from xrspatial import disaggregate, pycnophylactic, validate_disaggregation