DEM processing
DEM processing module.
- remote_sensing_processor.dem.aspect(input_path, output_path=None, normalize=False, nodata=None, write_stac=True)[source]
Calculates the aspect value of an elevation aggregate.
Calculates the downward slope direction of each cell based on the elevation of its neighbors in a 3x3 grid. The value is measured clockwise in degrees with 0 (due north), and 360. Values along the edges are not calculated. Values of -1 denote flat areas.
- Parameters:
input_path (string or STAC Item) – Path to input file, directory or STAC dataset or a STAC Item (e.g., from Planetary Computer).
output_path (string (optional)) – Path to an output file, directory, or STAC dataset. If not set, then will overwrite the input files.
normalize – Whether min-max data normalization needed.
nodata (int or float (default = None)) – Nodata value. If not set, then is read from inputs.
write_stac (bool (default = True)) – If True, then output metadata is saved to a STAC file.
- Returns:
output_path – Path where output raster is saved.
- Return type:
pathlib.Path
Examples
>>> import remote_sensing_processor as rsp >>> rsp.dem.aspect( ... input_path="/home/rsp_test/DEM.tif", ... output_path="/home/rsp_test/aspect.tif", ... )
- remote_sensing_processor.dem.curvature(input_path, output_path=None, normalize=False, nodata=None, write_stac=True)[source]
Calculates the curvature (second derivative) of each cell based on the elevation of its neighbors in a 3x3 grid.
Positive curvature indicates the surface is upwardly convex. A negative value indicates it is upwardly concave. A value of 0 indicates a flat surface.
- Parameters:
input_path (string or STAC Item) – Path to input file, directory or STAC dataset or a STAC Item (e.g., from Planetary Computer).
output_path (string (optional)) – Path to an output file, directory, or STAC dataset. If not set, then will overwrite the input files.
normalize – Whether min-max data normalization needed.
nodata (int or float (default = None)) – Nodata value. If not set, then is read from inputs.
write_stac (bool (default = True)) – If True, then output metadata is saved to a STAC file.
- Returns:
output_path – Path where output raster is saved.
- Return type:
pathlib.Path
Examples
>>> import remote_sensing_processor as rsp >>> rsp.dem.curvature( ... input_path="/home/rsp_test/DEM.tif", ... output_path="/home/rsp_test/curvature.tif", ... )
- remote_sensing_processor.dem.hillshade(input_path, output_path=None, azimuth=225, angle_altitude=25, nodata=None, write_stac=True)[source]
Applies hillshade to a raster DEM.
Calculates an illumination value of each cell based on illumination from a specific azimuth and altitude.
- Parameters:
input_path (string or STAC Item) – Path to input file, directory or STAC dataset or a STAC Item (e.g., from Planetary Computer).
output_path (string (optional)) – Path to an output file, directory, or STAC dataset. If not set, then will overwrite the input files.
azimuth (int (default = 225)) – The angle between the north vector and the perpendicular projection of the light source down onto the horizon specified in degrees.
angle_altitude (int (default = 25)) – Altitude angle of the sun specified in degrees.
nodata (int or float (default = None)) – Nodata value. If not set, then is read from inputs.
write_stac (bool (default = True)) – If True, then output metadata is saved to a STAC file.
- Returns:
output_path – Path where output raster is saved.
- Return type:
pathlib.Path
Examples
>>> import remote_sensing_processor as rsp >>> rsp.dem.hillshade( ... input_path="/home/rsp_test/DEM.tif", ... output_path="/home/rsp_test/hillshade.tif", ... azimuth=250, ... angle_altitude=40, ... )
- remote_sensing_processor.dem.slope(input_path, output_path=None, normalize=False, nodata=None, write_stac=True)[source]
Calculates a slope (amount of change in elevation) in the input image in degrees.
- Parameters:
input_path (string or STAC Item) – Path to input file, directory or STAC dataset or a STAC Item (e.g., from Planetary Computer).
output_path (string (optional)) – Path to an output file, directory, or STAC dataset. If not set, then will overwrite the input files.
normalize – Whether min-max data normalization needed.
nodata (int or float (default = None)) – Nodata value. If not set, then is read from inputs.
write_stac (bool (default = True)) – If True, then output metadata is saved to a STAC file.
- Returns:
output_path – Path where output raster is saved.
- Return type:
pathlib.Path
Examples
>>> import remote_sensing_processor as rsp >>> rsp.dem.slope( ... input_path="/home/rsp_test/DEM.tif", ... output_path="/home/rsp_test/slope.tif", ... )