DEM Visualization Module
This module contains a helper class (RasterViz) that is invoked by the REM module to create visualizations. It can also be used standalone to create customized visualizations of DEM/REM rasters.
- class riverrem.RasterViz.RasterViz(dem, out_dir='./', out_ext='.tif', make_png=False, make_kmz=False, docker_run=False, shell=False, cache_dir='./.cache', *args, **kwargs)
Handler to produce DEM derivatives/visualizations.
- Parameters
dem (str) – path to input DEM, either in GeoTIFF (.tif), ASCII (.asc), or IMG (.img) format.
out_dir (str) – output file directory. Defaults to current working directory.
out_ext (str, '.tif' or '.img') – extension for output georaster files.
make_png (bool) – output a png image of visualizations (EPSG:3857) in addition to a raster in source projection.
make_kmz (bool) – output a kmz file (e.g. Google Earth) of visualizations in addition to a raster in source projection.
docker_run (bool) – only if shell=True as well, calls gdal utilities from shell with docker container. Must have the osgeo/gdal docker container configured locally to use this option.
shell (bool) – call gdal utilities from a shell instead of using the Python bindings. May run faster for large files but can be more difficult to configure GDAL environment outside conda.
cache_dir (str) – cache directory
- make_aspect(*args, **kwargs)
Make aspect map from DEM, with aspect at each pixel in degrees [0-360].
- Returns
path to output aspect raster.
- Return type
str
- make_color_relief(cmap='terrain', log_scale=False, *args, **kwargs)
Make color relief map from DEM (3 band RGB raster).
- Parameters
cmap (str) – matplotlib or seaborn named colormap to use for making color relief map. (see https://matplotlib.org/stable/gallery/color/colormap_reference.html)
log_scale (bool) – bool, makes the colormap on a log scale from zero, so terrain closer to 0 elevation has greater color variation. Intended to be used for REMs or coastal datasets.
- Returns
path to output color-relief raster.
- Return type
str
- make_hillshade(z=1, alt=45, azim=315, multidirectional=False, *args, **kwargs)
Make hillshade raster from the input DEM.
- Parameters
z (float >1) – z factor for exaggerating vertical scale differences (default 1).
alt (float [0-90]) – altitude of light source in degrees (default 45).
azim (float [0-360]) – azimuth for light source in degrees (default 315).
multidirectional (bool) – makes multidirectional hillshade if True, overriding alt and azim.
- Returns
path to output hillshade raster.
- Return type
str
- make_hillshade_color(blend_percent=60, *args, **kwargs)
Make a pretty composite hillshade/color-relief image.
- Parameters
blend_percent (float [0-100]) – Percent weight of hillshdae in blend, color-relief takes opposite weight.
This method also accepts all arguments of make_hillshade and make_color_relief if the respective rasters have not yet been created.
- Returns
path to output hillshade-color raster.
- Return type
str
- make_roughness(*args, **kwargs)
Make roughness map from DEM.
- Returns
path to output roughness raster.
- Return type
str
- make_slope(*args, **kwargs)
Make slope map from DEM, with slope at each pixel in degrees [0-90].
- Returns
path to output slope raster.
- Return type
str