get_new_shape

Contents

get_new_shape#

get_new_shape(ds: str | tuple | ~rasterio.io.DatasetReader, resolution: tuple | list | float, size: tuple | list, window: ~rasterio.windows.Window = None) -> (<class 'int'>, <class 'int'>, <class 'bool'>)[source]#

Get the new shape (height, width) of a resampled raster.

Parameters:
  • ds (PATH_ARR_DS) – Path to the raster, its dataset, its xarray or a tuple containing its array and metadata

  • resolution (Union[tuple, list, float]) – Resolution of the wanted band, in dataset resolution unit (X, Y)

  • size (Union[tuple, list]) – Size of the array (width, height). Not used if resolution is provided.

  • window (Window) – Window to be read

Returns:

Height, width, do resampling

Return type:

(int, int, bool)