get_new_shape#
- get_new_shape(ds: str | ~cloudpathlib.cloudpath.CloudPath | ~pathlib.Path | tuple[~numpy.ndarray | ~numpy.ma.MaskedArray, dict] | ~xarray.core.dataarray.DataArray | ~xarray.core.dataset.Dataset | ~rasterio.io.DatasetReader | ~rasterio.io.DatasetWriter, 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.
Size overrides resolution
- Parameters:
ds (AnyRasterType) – Path to the raster, its dataset, its
xarrayor a tuple containing its array and metadataresolution (tuple | list | float) – Resolution of the wanted band, in dataset resolution unit (X, Y)
size (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: