15.2 Preprocessing
The next step is to compute variables
- modeling and predictive mapping
- aligning the Non-metric multidimensional scaling (NMDS) axes with the main gradient in the study area, altitude and humidity, respectively
15.2.1 Bridges to GIS Software
::qgis_show_help("saga:sagawetnessindex")
qgisprocess#> Saga wetness index (saga:sagawetnessindex)
#> ...
#> ----------------
#> Arguments
#> ----------------
#>
#> DEM: Elevation
#> Argument type: raster
#> Acceptable values:
#> - Path to a raster layer
#> ...
#> SLOPE_TYPE: Type of Slope
#> Argument type: enum
#> Available values:
#> - 0: [0] local slope
#> - 1: [1] catchment slope
#> ...
#> AREA: Catchment area
#> Argument type: rasterDestination
#> Acceptable values:
#> - Path for new raster layer
#>...
#> ----------------
#> Outputs
#> ----------------
#>
#> AREA: <outputRaster>
#> Catchment area
#> SLOPE: <outputRaster>
#> Catchment slope
#> ...
# environmental predictors: catchment slope and catchment area
= qgisprocess::qgis_run_algorithm(
ep alg = "saga:sagawetnessindex",
DEM = dem,
SLOPE_TYPE = 1,
SLOPE = tempfile(fileext = ".sdat"),
AREA = tempfile(fileext = ".sdat"),
.quiet = TRUE)
# read in catchment area and catchment slope
= ep[c("AREA", "SLOPE")] |>
ep unlist() |>
::rast()
terranames(ep) = c("carea", "cslope") # assign proper names
::origin(ep) = terra::origin(dem) # make sure rasters have the same origin
terra= c(dem, ndvi, ep) # add dem and ndvi to the multilayer SpatRaster object ep
$carea = log10(ep$carea) #since data was skewed right ep
15.2.2 Site Locations
# this raster was made available for convenience
= terra::rast(system.file("raster/ep.tif", package = "spDataLarge")) ep
# terra::extract adds automatically a for our purposes unnecessary ID column
= terra::extract(ep, random_points) |>
ep_rp select(-ID)
= cbind(random_points, ep_rp)
random_points
str(ep_rp, give.attr = FALSE)
## 'data.frame': 100 obs. of 4 variables:
## $ dem : num 272 280 283 292 299 299 304 308 310 310 ...
## $ ndvi : num -0.36 -0.349 -0.34 -0.364 -0.336 ...
## $ carea : num 5.79 4.85 5.73 3.79 3.85 ...
## $ cslope: num 0.337 0.2275 0.41 0.0999 0.3691 ...