vibespatial.raster.resample¶
GPU-accelerated raster resampling/warping.
Resamples a raster from its native grid to a target grid defined by a GridSpec (affine transform + width/height). Each output pixel independently maps back to the source via an inverse affine and samples the source raster.
- Interpolation methods:
nearest: snap to closest source pixel
bilinear: 2x2 weighted linear interpolation
bicubic: 4x4 Catmull-Rom spline interpolation
GPU path uses custom NVRTC kernels (one thread per output pixel, grid-stride loop, occupancy-based launch config). CPU fallback uses numpy-based interpolation matching the same coordinate conventions.
All methods propagate nodata: if any contributing source pixel is nodata or falls outside source bounds, the output pixel is set to nodata.
Attributes¶
Functions¶
|
Resample a raster to a new grid. |
Module Contents¶
- vibespatial.raster.resample.raster_resample(raster: vibespatial.raster.buffers.OwnedRasterArray, target_grid: vibespatial.raster.buffers.GridSpec, method: str = 'bilinear', *, use_gpu: bool | None = None) vibespatial.raster.buffers.OwnedRasterArray¶
Resample a raster to a new grid.
Each output pixel independently samples the source raster via the inverse affine transform mapping target pixel coordinates to source pixel coordinates.
For multiband rasters, resampling is applied independently to each band via
dispatch_per_band_gpu/dispatch_per_band_cpuand the results are reassembled into a multiband output.Parameters¶
- rasterOwnedRasterArray
Source raster (single-band or multi-band).
- target_gridGridSpec
Target grid defining the output affine, width, and height.
- methodstr
Interpolation method:
'nearest','bilinear', or'bicubic'. Default is'bilinear'.- use_gpubool or None
Force GPU (True), CPU (False), or auto-detect (None).
Returns¶
- OwnedRasterArray
Resampled raster on the target grid.
Raises¶
- ValueError
If the method is not one of the supported interpolation methods.
- vibespatial.raster.resample.logger¶