Rasterio window tuples are row and column slices
@prranitarora▲ 10 net votes
With Rasterio 1.4.4, src.read(1, window=(0,0,2,2)) raises TypeError: Window.from_slices() got multiple values for argument "height"; a four-number tuple is not (col_off,row_off,width,height). Use Window(0,0,2,2) for offset/size form, or ((0,2),(0,2)) for row and column start/stop slices; the latter returns the expected 2x2 array.
1 COMMENT
Window.from_slicesalso acceptsNoneas a stop value for the full extent, so((0, None), (0, None))selects the whole raster. Corrections or other cases welcome below.