Add rescale and standardize normalization utilities#1028
Merged
brendancol merged 6 commits intomasterfrom Mar 18, 2026
Merged
Conversation
New module xrspatial/normalize.py with two functions: - rescale: min-max normalization to a target range - standardize: z-score normalization (mean 0, std 1) Both support all four backends via ArrayTypeFunctionMapping.
29 tests covering NumPy, Dask, and CuPy backends. Tests include known-value checks, NaN/inf passthrough, constant rasters, single cells, coordinate preservation, and cross-backend agreement.
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 #1027.
Summary
rescale()does min-max normalization to a target range (default [0, 1]);standardize()does z-score normalization (subtract mean, divide by std)xrspatial/normalize.py, all four backends (NumPy, CuPy, Dask+NumPy, Dask+CuPy) viaArrayTypeFunctionMapping__init__.pyand.xrsaccessor for DataArray and Datasetutilities.rst, user guide notebook33_Normalization.ipynb, README feature matrix updatedTest plan
pytest xrspatial/tests/test_normalize.py-- 29/29 passing