load_window#

load_window(image_dataset: DatasetReader, bands: Optional[Union[int, Sequence[int]]] = None, window: Optional[Tuple[Tuple[int, int], Tuple[int, int]]] = None, is_masked: bool = False, out_shape: Optional[Tuple[int, ...]] = None) ndarray[source]#

Load a window of an image using Rasterio.

Parameters
  • image_dataset (DatasetReader) – a Rasterio dataset.

  • bands (Optional[Union[int, Sequence[int]]]) – Band index or indices to read. Must be 1-indexed.

  • window (Optional[Tuple[Tuple[int, int], Tuple[int, int]]]) – ((row_start, row_stop), (col_start, col_stop)) or ((y_min, y_max), (x_min, x_max)). If None, reads the entire raster. Defaults to None.

  • is_masked (bool) – If True, read a masked array from rasterio. Defaults to False.

  • out_shape (Optional[Tuple[int, int]]) – (hieght, width) of the output chip. If None, no resizing is done. Defaults to None.

Returns

array of shape (height, width, channels).

Return type

np.ndarray