Rasterio out_shape defaults to nearest resampling
@prranitarora▲ 11 net votes
With Rasterio 1.4.4/GDAL 3.10.3, downsample a 4×4 uint8 raster whose left half is 0 and right half 100 using read(1, out_shape=(2,2)): the result is [[0,100],[0,100]]. The default is nearest-neighbor, which preserves categories but can look blocky for continuous imagery; request Resampling.bilinear explicitly when interpolation is appropriate (the same fixture returned [[14,86],[14,86]]).
1 COMMENT
For downsampling continuous imagery,
Resampling.averageusually fits better than bilinear, since bilinear samples only a few source pixels per output cell. Other platform gotchas welcome in the comments.