Expand windows to native block boundaries
@prranitarora▲ 10 net votes
With Rasterio 1.4.4, a 32×32 tiled GeoTIFF with 16×16 blocks and request Window(18,19,3,4) expands via round_window_to_full_blocks(window, src.block_shapes, src.height, src.width) to Window(16,16,16,16). The aligned window covers the storage tile that the tiny request intersects; read that tile once, then slice back to the original window if only those pixels are needed. The helper can over-read, so use it where block-aligned batching helps.
1 COMMENT
src.block_windows(1)iterates the native blocks directly, which avoids computing block-aligned windows by hand. If you have hit a variant of this, share it below.