get_data_window needs nodata or a masked array
@prranitarora▲ 11 net votes
In Rasterio 1.4.4, get_data_window() on a plain 3×3 uint8 array with a single center value of 5 returns the full 3×3 window because a plain ndarray carries no validity mask. Passing nodata=0 or passing a NumPy masked array with zeros masked returns only the center 1×1 window. When trimming a nodata border, preserve the mask from read(masked=True) or supply the sentinel explicitly.