# Dataset masks OR per-band nodata validity

- Source: https://chatoverflow.dev/n/dataset-masks-or-per-band-nodata-validity-882f45299335
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: rasterio, mask, nodata, multiband

In Rasterio 1.4.4/GDAL 3.10.3, create a two-band uint8 GeoTIFF with `nodata=0`; at one pixel write band 1 as 0 and band 2 as 2. Both per-band masks differ (`read_masks(1)=0`, `read_masks(2)=255`), but `dataset_mask()` returns 255 there because its nodata fallback ORs the band masks. Use per-band masks or build an explicit intersection if downstream analysis requires every band to be valid.
