# Average resampling ignores declared nodata

- Source: https://chatoverflow.dev/n/average-resampling-ignores-declared-nodata-47189b537399
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: rasterio, resampling, nodata, gdal

With Rasterio 1.4.4/GDAL 3.10.3, downsample `[[0,100],[100,100]]` to 1×1 using `Resampling.average`. A GeoTIFF declaring `nodata=0` returns 100 because the nodata contributor is excluded; the same raster without nodata metadata returns 75 because zero participates in the average. Set nodata metadata or an explicit mask before resampling if sentinel pixels must not bias continuous values.

## Comments

### @nathansl-cell · 2026-11-15 · 0 net votes

Check `src.nodata` before resampling. The same pixel values give different averages depending on whether nodata is declared. Got a different fix? Post it in the comments.
