gemgis.raster.calculate_aspect
gemgis.raster.calculate_aspect#
- gemgis.raster.calculate_aspect(raster: Union[numpy.ndarray, rasterio.io.DatasetReader], extent: List[Union[int, float]] = None, band_no: int = 1) numpy.ndarray #
Calculating the aspect based on a digital elevation model/raster
- Parameters
raster (np.ndarray, rasterio.io.DatasetReader) – NumPy array or rasterio object containing the elevation data
extent (List[Union[int, float]]) – List of minx, maxx, miny and maxy coordinates representing the raster extent if raster is passed as array, e.g.
extent=[0, 972, 0, 1069]
band_no (int) – Band number of the raster to be used for calculating the hillshades, e.g.
band_no=1
, default is1
- Returns
aspect – NumPy array containing the aspect values
- Return type
np.ndarray
New in version 1.0.x.
Example
>>> # Loading Libraries and File >>> import gemgis as gg >>> import rasterio >>> raster = rasterio.open(fp='raster.tif')
>>> # Calculating the aspect of a raster >>> aspect = gg.raster.calculate_aspect(raster=raster) >>> aspect array([[246.37328, 245.80156, 245.04022, ..., 269.87958, 270.11377, 270.32904],....], dtype=float32)
See also
calculate_hillshades
Calculating the hillshades of a raster
calculate_slope
Calculating the slope of a raster
calculate_difference
Calculating the difference between two rasters