-
Notifications
You must be signed in to change notification settings - Fork 86
Add standalone raster resampling (resolution change without reprojection) #1152
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Motivation
Changing a raster's resolution (e.g., 10 m to 30 m, or 1 km to 250 m) without changing its CRS is one of the most common raster operations. Right now the only way to do this in xarray-spatial is to call reproject() with the same source and target CRS, which is awkward and unnecessarily slow since it runs the full reprojection pipeline (coordinate transforms, etc.) even though nothing is actually being reprojected.
This is what people use gdalwarp -tr for when the source and target CRS are the same.
Proposed API
resample(da, scale_factor=0.5) # halve the resolution
resample(da, target_resolution=30.0) # resample to 30m pixelsScope
- Resampling methods: nearest, bilinear, cubic, average, mode (for categorical), min, max, median.
- Both upsampling and downsampling.
- Coordinate arrays and spatial attributes should be updated to reflect the new resolution.
- Nodata handling: nodata pixels must not contribute to weighted methods like average or bilinear interpolation.
- Dask-friendly: should work as a blockwise or overlap operation depending on the resampling method. Nearest/mode can be blockwise; bilinear/cubic need overlap with appropriate depth.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request