hillshade#
- hillshade(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, azimuth: float = 315, zenith: float = 45) -> (<class 'numpy.ma.MaskedArray'>, <class 'dict'>)[source]#
Compute the hillshade of a DEM from an azimuth and zenith 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 (AnyRasterType): Path to the raster, its dataset, its
xarray
or a tuple containing its array and metadata azimuth (float): Azimuth of the light, in degrees. 0 if it comes from the top of the raster, 90 from the east, … zenith (float): Zenith angle in degrees- Returns:
(np.ma.masked_array, dict): Hillshade and its metadata