gemgis.raster.resize_raster
gemgis.raster.resize_raster#
- gemgis.raster.resize_raster(raster: Union[numpy.ndarray, rasterio.io.DatasetReader], width: int, height: int) numpy.ndarray #
Resizing raster to given dimensions
- Parameters
array (Union[np.ndarray, rasterio.io.DatasetReader]) – Array that will be resized
width (int) – Width of the resized array, e.g.
width=100
height (int) – Height of the resized array, e.g.
height=100
- Returns
array_resized – Resized array
- Return type
np.ndarray
New in version 1.0.x.
Example
>>> # Loading Libraries and File >>> import gemgis as gg >>> import rasterio >>> import numpy as np >>> raster = rasterio.open(fp='raster.tif') >>> raster.read(1).shape (275, 250)
>>> # Resizing raster >>> raster_resized = gg.raster.resize_raster(raster=raster, width=10, height=10) >>> raster_resized.shape (10, 10)
See also
resize_by_array
Resizing a raster by the shape of another array