hillshade
hillshade#
- hillshade(ds: typing.Union[str, tuple, rasterio.io.DatasetReader], azimuth: float = 315, zenith: float = 45) -> (<class 'numpy.ma.core.MaskedArray'>, <class 'dict'>)[source]#
Compute the hillshade of a DEM from an azimuth and elevation angle (in degrees).
Goal: replace gdaldem CLI
NB: altitude = 90 - zenith
Warning
It uses a 2nd order gradient instead of Horn’s or Zevenbergen & Thorne’s formula
z_factor is fixed to 1.0
scale managed by ds resolution
- Args:
ds (PATH_ARR_DS): Path to the raster, its dataset, its
xarray
or a tuple containing its array and metadata azimuth (float): Azimuth angle in degrees zenith (float): Zenith angle in degrees- Returns:
(np.ma.masked_array, dict): Hillshade and its metadata