r.slopeunits
Slope units delineation has been developed and described by Alvioli et al. (2016, 2020) as a useful tool to subdivide terrain units and use as an input layer for landslide susceptibility analyses.
Unfortunately, I run by some trouble when running the code posted on their website. But, recently during the #vEGU21 the authors of the course provided a short course , which provided a virtual machine with updated code and slides to learn about the method. For now, I do not count with the authorization to share these materials through this repository, but will hope to contact the authors!
The usage of the software requires GRASS GIS, and it is designed to run ideally on a Linux environment. To bypass any difficulties regarding operating systems, I use the GRASS GIS Docker Image by Mundialis to run the code.
- Inside the Command Prompt, build the image using the Dockerfile in this directory
```
cd executable_code/rslopeunit
docker build -t [image-name] .
``` <!--- docker build -t slu-grass78 . --->
- Create a container with a mounted volume:
```
docker run -it -v [local_path:/home/] --name [container_name] [image-name]
``` <!--- docker run -it -v D:/STEC/Earthflows_R:/home/ --name rslopeunits slu-grass78 --->
Mounting a container is my preferred setup, since results will be saved to the host and not inside the docker, so I can easily explore them later.
If you already have a setup container, with a mounted volume and some work done, then run this in your command line:
docker start [container_name]
docker exec -it [container_name] bash
In my case, the container name is rslopeunits
.
r.slopeunits
is accessible.# Inside the container
grass --tmp-location EPSG:4326 --exec
r.slopeunits --help
Create a raster layer of slope units
Usage:
r.slopeunits [-mn] demmap=name [plainsmap=name] slumap=name
[slumapclean=name] [circvarmap=name] [areamap=name] thresh=value
areamin=value [areamax=value] cvmin=value rf=value maxiteration=value
[cleansize=value] [--overwrite] [--help] [--verbose] [--quiet] [--ui]
Flags:
-m Perform quick cleaning of small-sized areas and stripes
-n Perform detailed cleaning of small-sized areas (slow)
Parameters:
demmap Input digital elevation model
plainsmap Input raster map of alluvial_plains
slumap Output Slope Units layer (the main output)
slumapclean Output Slope Units layer (the main output)
circvarmap Output Circular Variance layer
areamap Output Area layer; values in square meters
thresh Initial threshold (m^2).
areamin Minimum area (m^2) below whitch the slope unit is not further segmented
areamax Maximum area (m^2) above which the slope unit is segm is segmented irrespective of aspect
cvmin Minimum value of the circular variance (0.0-1.0) belo.0) below whitch the slope unit is not further segmented
rf Factor used to iterativelly reduce initial threshold:reshold: newthresh=thresh-thresh/reductionfactor
maxiteration maximum number of iteration to do before the procedur
procedure is in any case stopped
cleansize Slope Units size to be removed
We will create a temporal location based on our georeferenced TIFF and we will execute a bash script that will export the results to the mounted volume, see more details on batch jobs in GRASS here.
# Give shell file execution rights
chmod ugo+x /home/executable_code/rslopeunit/slumap.sh
# Navigate to the data folder
cd home/data_rs/
# Run shell file
grass78 --tmp-location home/data_rs/dsm_filled_sa1_3m.tif --exec /home/executable_code/rslopeunit/slumap.sh
NOTE! For some reason, the bash script won’t run properly. So until finding a solution to that, I ran the code inside grass78
. So basically:
## On the command line
# Navigate to the data location
cd home/data_rs/
# Create a temporary location
grass78 --tmp-location dsm_filled_sa1_3m.tif
## inside grass
# register GeoTIFF file to be used in current mapset:
r.external input=/home/data_rs/dsm_filled_sa1_3m.tif output=dsm
# define output directory for files resulting from GRASS calculation:
v.external.out output=/home/slopeunits/
# Run r.slopeunits
r.slopeunits demmap=dsm slumap=slumap thresh=1e2 cvmin=0.15 rf=2 areamin=10000 maxiteration=2
# Convert result to vector
r.to.vect input=slumap output=slumap type=area --o --q
Alvioli M., Guzzetti F., Marchesini I. (2020). Parameter-free delineation of slope units and terrain subdivision of Italy. Geomorphology 258, 107124. https://doi.org/10.1016/j.geomorph.2020.107124
Alvioli M., Marchesini I., Reichenbach P., Rossi M., Ardizzone F., Fiorucci F., Guzzetti F. (2016). Automatic delineation of geomorphological slope units with r.slopeunits v1.0 and their optimization for landslide susceptibility modeling. Geoscientific Model Development 9, 3975-3991. https://doi.org/10.5194/gmd-9-3975-2016