/pemgeneratr

Primary LanguageRApache License 2.0Apache-2.0

Last tested with R version 4.0.5

We are currently migrating and consolidating scripts to

https://github.com/bcgov/PEMr

Dependancies

predict_landscape() relies on a couple older packages:

  1. GSIF can be installed via remotes::install_version("GSIF", version = "0.5-5")
  2. gdalUtils can be installed via: devtools:::install_github("gearslaboratory/gdalUtils")
    • gdal also needs to be avalilable on the system.
    • For windows I find the easiest is to install gdal via the OSGeo4w installer. Once installed, add the directory that contains gdalinfo.exe to the system PATH -- to make it available with out specifying full path (e.g. C:\OSGeo4W\bin).

`pemgeneratr`

library(tidyverse)
library(knitr)
library(kableExtra) ##devtools::install_github("haozhu233/kableExtra")

library(sf)
library(raster)
library(rgdal)
library(tmap)

devtools::install_github("ColinChisholm/pemgeneratr")
library(pemgeneratr) ## OUR NEW PACKAGE

The scenario example

For demonstration purposes a harvest block from the Aleza Lake Research Forest has been selected to predict the ecosystem classes within the block area using British Columbia’s BC’s Biogeoclimatic Ecosystem Classification (BEC) system.

Generate Co-variates

To start this package will examine DTM derived layers. Note: incorporation of satellite data is scheduled for development.

Additionally, for this example a small sub-set of data is use. Additional scripting will be needed to tile data for parallel process and landscape level analysis.

Area of interest: aoi_snap()

A polygon is loaded and the extent of that polygon is used to determine the area of interest. However, in order to get the various resolutions of data to stack well, essential for later processing, it is critically important that the all corners of the area of interest are divisible by the resolutions to be generated (i.e. 2.5, 5, 10, and 25m2). To accomplish this the raw aoi interest polygon’s extent is pushed out to the nearest 100m.

Note: The area of interest needs to be within the bounds of the extent of the input raster. Currently, aoi_snap() expands the aoi perhaps a version that shrinks the aoi should be created (this could be a parameter specification).

aoi_raw <- st_read("../data/block.gpkg", quiet = TRUE)
e <- as(extent(aoi_raw), "SpatialPolygons") ## for use in map below.
aoi <- aoi_snap(aoi_raw)
## [1] "initial extent is:"
##      xmin      ymin      xmax      ymax 
##  558347.9 5994757.5  559700.9 5995734.5 
## [1] "Expanded extent is:"
##    xmin    ymin    xmax    ymax 
##  558300 5994700  559800 5995800

Initial Digital Terrain Models

Here the DTM is loaded and cropped to the area of interest. The multiple resolutions of the DTM are generated, and then the co-variates are generated.

Note for the project we have decided to start with 2.5m2 as the finest pixel resolution. In the example below the initial DTM is 1m2 resolution which is used to generate the coarser resolutions.

Load DTM

# dtm <- data(dtm) ## Sample data provided -- ACTION DOCUMENT THIS.... not working
dtm <- raster("../data/dtm.tif")
dtm_e <- as(extent(dtm), "SpatialPolygons") ## for use in map below

dim(dtm); extent(dtm)
## [1] 1835 2226    1

## class      : Extent 
## xmin       : 557905 
## xmax       : 560131 
## ymin       : 5994293 
## ymax       : 5996128

Crop DTM aoi_snap()

The DTM is cropped to the aoi expanded out to the nearest 100m. This will allow for stacking of multi resolution layers later.

dtm <- crop(dtm, aoi)
dim(dtm) ; extent(dtm)
## [1] 1100 1500    1

## class      : Extent 
## xmin       : 558300 
## xmax       : 559800 
## ymin       : 5994700 
## ymax       : 5995800

Below the original extent of the DTM is in red. The original area of interest is in green, based on the shapefile received is in green, and the adjusted area of interest is the color raster dtm. This new extent is based on an adjusted area of interest – expanded out to the nearest 100m.

Generate Multi-resolutions: multi_res()

Ecological processes take place across different scales. In an effort to incorporate this into the modeling process multiple scales of covariates are generated. This project will work with resolutions of 2.5, 5, 10, and 25m2. This function takes the input raster and resamples it to the target resolutions while ensuring that all rasters have the same exact extent – allowing for stacking of the rasters later.

outputFolder <- "e:/tmp/dtms"

## Generate alternate coarser grain resolutions of the input
multi_res(dtm, output = outputFolder, resolution = c(2.5, 5, 10, 25))

# confirms same extent
  l <- list.files(outputFolder, pattern = "*.tif", recursive = TRUE, full.names = TRUE)

  for(i in l){
  c <- raster(i) ;   print(i) ;  print("Resolution") ;  print(res(c)) ; print(as.vector(extent(c)))
  }
## [1] "e:/tmp/dtms/10/dtm_10.tif"
## [1] "Resolution"
## [1] 10 10
## [1]  558300  559800 5994700 5995800
## [1] "e:/tmp/dtms/2.5/dtm_2.5.tif"
## [1] "Resolution"
## [1] 2.5 2.5
## [1]  558300  559800 5994700 5995800
## [1] "e:/tmp/dtms/25/dtm_25.tif"
## [1] "Resolution"
## [1] 25 25
## [1]  558300  559800 5994700 5995800
## [1] "e:/tmp/dtms/5/dtm_5.tif"
## [1] "Resolution"
## [1] 5 5
## [1]  558300  559800 5994700 5995800

Generate terrain co-variates: cv_dtm()

This function makes external calls for SAGA GIS to create the co-variates, converts these to geoTif, and removes the tmp files

Note that these functions did not work with the bundled OSgeo4W (SAGA 2.1). Make sure you have an installation of SAGA 7.x.

For demonstration the 25m raster is co-variates are generated.

output_CoVars <- "e:/tmp" ## where to place the covariates

l <- list.files(outputFolder, recursive = TRUE, full.names = TRUE) ## list of DTMs to process


if(!dir.exists(output_CoVars)){## skip this if they are already generated -- for easier report generation.
  for(i in l){  ## Loop through Resolutions and produce covariates
    # i<-l[1] ##testing

    print(i)
    dtm <- raster(i)
    cv_dtm(dtm, SAGApath = "C:/SAGA/", output = output_CoVars)
  }
}

A Summary table of files generated

File xmin xmax ymin ymax res
Aspect\_10.tif 558300 559800 5994700 5995800 10.0
Aspect\_10.tif 558300 559800 5994700 5995800 2.5
Aspect\_2.5.tif 558300 559800 5994700 5995800 2.5
Aspect\_25.tif 558300 559800 5994700 5995800 2.5
Aspect\_25.tif 558300 559800 5994700 5995800 25.0
Aspect\_5.tif 558300 559800 5994700 5995800 2.5
Aspect\_5.tif 558300 559800 5994700 5995800 5.0
Channel\_network\_grid\_10.tif 558300 559800 5994700 5995800 10.0
Channel\_network\_grid\_10.tif 558300 559800 5994700 5995800 2.5
Channel\_network\_grid\_2.5.tif 558300 559800 5994700 5995800 2.5
Channel\_network\_grid\_25.tif 558300 559800 5994700 5995800 2.5
Channel\_network\_grid\_25.tif 558300 559800 5994700 5995800 25.0
Channel\_network\_grid\_5.tif 558300 559800 5994700 5995800 2.5
Channel\_network\_grid\_5.tif 558300 559800 5994700 5995800 5.0
Convergence\_10.tif 558300 559800 5994700 5995800 10.0
Convergence\_10.tif 558300 559800 5994700 5995800 2.5
Convergence\_2.5.tif 558300 559800 5994700 5995800 2.5
Convergence\_25.tif 558300 559800 5994700 5995800 2.5
Convergence\_25.tif 558300 559800 5994700 5995800 25.0
Convergence\_5.tif 558300 559800 5994700 5995800 2.5
Convergence\_5.tif 558300 559800 5994700 5995800 5.0
cvs.tif 552600 567850 5983800 5996850 2.5
dAH\_10.tif 558300 559800 5994700 5995800 10.0
dAH\_10.tif 558300 559800 5994700 5995800 2.5
dAH\_2.5.tif 558300 559800 5994700 5995800 2.5
dAH\_25.tif 558300 559800 5994700 5995800 2.5
dAH\_25.tif 558300 559800 5994700 5995800 25.0
dAH\_5.tif 558300 559800 5994700 5995800 2.5
dAH\_5.tif 558300 559800 5994700 5995800 5.0
difinsol\_10.tif 558300 559800 5994700 5995800 10.0
difinsol\_10.tif 558300 559800 5994700 5995800 2.5
difinsol\_2.5.tif 558300 559800 5994700 5995800 2.5
difinsol\_25.tif 558300 559800 5994700 5995800 2.5
difinsol\_25.tif 558300 559800 5994700 5995800 25.0
difinsol\_5.tif 558300 559800 5994700 5995800 2.5
difinsol\_5.tif 558300 559800 5994700 5995800 5.0
dirinsol\_10.tif 558300 559800 5994700 5995800 10.0
dirinsol\_10.tif 558300 559800 5994700 5995800 2.5
dirinsol\_2.5.tif 558300 559800 5994700 5995800 2.5
dirinsol\_25.tif 558300 559800 5994700 5995800 2.5
dirinsol\_25.tif 558300 559800 5994700 5995800 25.0
dirinsol\_5.tif 558300 559800 5994700 5995800 2.5
dirinsol\_5.tif 558300 559800 5994700 5995800 5.0
dtm\_10.tif 558300 559800 5994700 5995800 10.0
dtm\_10.tif 558300 559800 5994700 5995800 2.5
dtm\_10.tif 558300 559800 5994700 5995800 10.0
dtm\_2.5.tif 558300 559800 5994700 5995800 2.5
dtm\_2.5.tif 558300 559800 5994700 5995800 2.5
dtm\_25.tif 558300 559800 5994700 5995800 2.5
dtm\_25.tif 558300 559800 5994700 5995800 25.0
dtm\_25.tif 558300 559800 5994700 5995800 25.0
dtm\_5.tif 558300 559800 5994700 5995800 2.5
dtm\_5.tif 558300 559800 5994700 5995800 5.0
dtm\_5.tif 558300 559800 5994700 5995800 5.0
Filled\_sinks\_10.tif 558300 559800 5994700 5995800 10.0
Filled\_sinks\_10.tif 558300 559800 5994700 5995800 2.5
Filled\_sinks\_2.5.tif 558300 559800 5994700 5995800 2.5
Filled\_sinks\_25.tif 558300 559800 5994700 5995800 2.5
Filled\_sinks\_25.tif 558300 559800 5994700 5995800 25.0
Filled\_sinks\_5.tif 558300 559800 5994700 5995800 2.5
Filled\_sinks\_5.tif 558300 559800 5994700 5995800 5.0
gCurvature\_10.tif 558300 559800 5994700 5995800 10.0
gCurvature\_10.tif 558300 559800 5994700 5995800 2.5
gCurvature\_2.5.tif 558300 559800 5994700 5995800 2.5
gCurvature\_25.tif 558300 559800 5994700 5995800 2.5
gCurvature\_25.tif 558300 559800 5994700 5995800 25.0
gCurvature\_5.tif 558300 559800 5994700 5995800 2.5
gCurvature\_5.tif 558300 559800 5994700 5995800 5.0
MRRTF\_10.tif 558300 559800 5994700 5995800 10.0
MRRTF\_10.tif 558300 559800 5994700 5995800 2.5
MRRTF\_2.5.tif 558300 559800 5994700 5995800 2.5
MRRTF\_25.tif 558300 559800 5994700 5995800 2.5
MRRTF\_25.tif 558300 559800 5994700 5995800 25.0
MRRTF\_5.tif 558300 559800 5994700 5995800 2.5
MRRTF\_5.tif 558300 559800 5994700 5995800 5.0
MRVBF\_10.tif 558300 559800 5994700 5995800 10.0
MRVBF\_10.tif 558300 559800 5994700 5995800 2.5
MRVBF\_2.5.tif 558300 559800 5994700 5995800 2.5
MRVBF\_25.tif 558300 559800 5994700 5995800 2.5
MRVBF\_25.tif 558300 559800 5994700 5995800 25.0
MRVBF\_5.tif 558300 559800 5994700 5995800 2.5
MRVBF\_5.tif 558300 559800 5994700 5995800 5.0
OpennessNegative\_10.tif 558300 559800 5994700 5995800 10.0
OpennessNegative\_10.tif 558300 559800 5994700 5995800 2.5
OpennessNegative\_2.5.tif 558300 559800 5994700 5995800 2.5
OpennessNegative\_25.tif 558300 559800 5994700 5995800 2.5
OpennessNegative\_25.tif 558300 559800 5994700 5995800 25.0
OpennessNegative\_5.tif 558300 559800 5994700 5995800 2.5
OpennessNegative\_5.tif 558300 559800 5994700 5995800 5.0
OpennessPositive\_10.tif 558300 559800 5994700 5995800 10.0
OpennessPositive\_10.tif 558300 559800 5994700 5995800 2.5
OpennessPositive\_2.5.tif 558300 559800 5994700 5995800 2.5
OpennessPositive\_25.tif 558300 559800 5994700 5995800 2.5
OpennessPositive\_25.tif 558300 559800 5994700 5995800 25.0
OpennessPositive\_5.tif 558300 559800 5994700 5995800 2.5
OpennessPositive\_5.tif 558300 559800 5994700 5995800 5.0
OverlandFlowDistance\_10.tif 558300 559800 5994700 5995800 10.0
OverlandFlowDistance\_10.tif 558300 559800 5994700 5995800 2.5
OverlandFlowDistance\_2.5.tif 558300 559800 5994700 5995800 2.5
OverlandFlowDistance\_25.tif 558300 559800 5994700 5995800 2.5
OverlandFlowDistance\_25.tif 558300 559800 5994700 5995800 25.0
OverlandFlowDistance\_5.tif 558300 559800 5994700 5995800 2.5
OverlandFlowDistance\_5.tif 558300 559800 5994700 5995800 5.0
Slope\_10.tif 558300 559800 5994700 5995800 10.0
Slope\_10.tif 558300 559800 5994700 5995800 2.5
Slope\_2.5.tif 558300 559800 5994700 5995800 2.5
Slope\_25.tif 558300 559800 5994700 5995800 2.5
Slope\_25.tif 558300 559800 5994700 5995800 25.0
Slope\_5.tif 558300 559800 5994700 5995800 2.5
Slope\_5.tif 558300 559800 5994700 5995800 5.0
Specific\_Catchment\_10.tif 558300 559800 5994700 5995800 10.0
Specific\_Catchment\_10.tif 558300 559800 5994700 5995800 2.5
Specific\_Catchment\_2.5.tif 558300 559800 5994700 5995800 2.5
Specific\_Catchment\_25.tif 558300 559800 5994700 5995800 2.5
Specific\_Catchment\_25.tif 558300 559800 5994700 5995800 25.0
Specific\_Catchment\_5.tif 558300 559800 5994700 5995800 2.5
Specific\_Catchment\_5.tif 558300 559800 5994700 5995800 5.0
tCatchment\_10.tif 558300 559800 5994700 5995800 10.0
tCatchment\_10.tif 558300 559800 5994700 5995800 2.5
tCatchment\_2.5.tif 558300 559800 5994700 5995800 2.5
tCatchment\_25.tif 558300 559800 5994700 5995800 2.5
tCatchment\_25.tif 558300 559800 5994700 5995800 25.0
tCatchment\_5.tif 558300 559800 5994700 5995800 2.5
tCatchment\_5.tif 558300 559800 5994700 5995800 5.0
tCurve\_10.tif 558300 559800 5994700 5995800 10.0
tCurve\_10.tif 558300 559800 5994700 5995800 2.5
tCurve\_2.5.tif 558300 559800 5994700 5995800 2.5
tCurve\_25.tif 558300 559800 5994700 5995800 2.5
tCurve\_25.tif 558300 559800 5994700 5995800 25.0
tCurve\_5.tif 558300 559800 5994700 5995800 2.5
tCurve\_5.tif 558300 559800 5994700 5995800 5.0
TPI\_10.tif 558300 559800 5994700 5995800 10.0
TPI\_10.tif 558300 559800 5994700 5995800 2.5
TPI\_2.5.tif 558300 559800 5994700 5995800 2.5
TPI\_25.tif 558300 559800 5994700 5995800 2.5
TPI\_25.tif 558300 559800 5994700 5995800 25.0
TPI\_5.tif 558300 559800 5994700 5995800 2.5
TPI\_5.tif 558300 559800 5994700 5995800 5.0
TRI\_10.tif 558300 559800 5994700 5995800 10.0
TRI\_10.tif 558300 559800 5994700 5995800 2.5
TRI\_2.5.tif 558300 559800 5994700 5995800 2.5
TRI\_25.tif 558300 559800 5994700 5995800 2.5
TRI\_25.tif 558300 559800 5994700 5995800 25.0
TRI\_5.tif 558300 559800 5994700 5995800 2.5
TRI\_5.tif 558300 559800 5994700 5995800 5.0
TWI\_10.tif 558300 559800 5994700 5995800 10.0
TWI\_10.tif 558300 559800 5994700 5995800 2.5
TWI\_2.5.tif 558300 559800 5994700 5995800 2.5
TWI\_25.tif 558300 559800 5994700 5995800 2.5
TWI\_25.tif 558300 559800 5994700 5995800 25.0
TWI\_5.tif 558300 559800 5994700 5995800 2.5
TWI\_5.tif 558300 559800 5994700 5995800 5.0
VerticalDistance\_10.tif 558300 559800 5994700 5995800 10.0
VerticalDistance\_10.tif 558300 559800 5994700 5995800 2.5
VerticalDistance\_2.5.tif 558300 559800 5994700 5995800 2.5
VerticalDistance\_25.tif 558300 559800 5994700 5995800 2.5
VerticalDistance\_25.tif 558300 559800 5994700 5995800 25.0
VerticalDistance\_5.tif 558300 559800 5994700 5995800 2.5
VerticalDistance\_5.tif 558300 559800 5994700 5995800 5.0

We are almost there! The Covariates have all been generated and they all have the same extent. However, They now need to have the same resolution – see the next section.

Prepare Covariate Raster Stack: cv_FineRes

cv_FineRes uses raster::disaggregate on the coarse grained rasters are converted to fine grain for stacking.

Note: all rasters that need to be pushed to the finer scale need to be divisible by that finer scale.

## Create list of covariate files.
l <- list.files("e:/tmp/5/", pattern = "*.tif", full.names = TRUE)
l <- append(l, list.files("e:/tmp/10/", pattern = "*.tif", full.names = TRUE))
l <- append(l, list.files("e:/tmp/25/", pattern = "*.tif", full.names = TRUE))


## Push list to fine resolution.
if(!dir.exists("e:/tmp/2.5_others")){  ## If statement for easier processing of document
cv_FineRes(inputFileList = l, output = "e:/tmp/2.5_others", targetRes = 2.5)
}

Summary table

Following cv_FineRes() all covariates are not of the same extent and resolution.

File xmin xmax ymin ymax res
Aspect\_10.tif 558300 559800 5994700 5995800 2.5
Aspect\_2.5.tif 558300 559800 5994700 5995800 2.5
Aspect\_25.tif 558300 559800 5994700 5995800 2.5
Aspect\_5.tif 558300 559800 5994700 5995800 2.5
Channel\_network\_grid\_10.tif 558300 559800 5994700 5995800 2.5
Channel\_network\_grid\_2.5.tif 558300 559800 5994700 5995800 2.5
Channel\_network\_grid\_25.tif 558300 559800 5994700 5995800 2.5
Channel\_network\_grid\_5.tif 558300 559800 5994700 5995800 2.5
Convergence\_10.tif 558300 559800 5994700 5995800 2.5
Convergence\_2.5.tif 558300 559800 5994700 5995800 2.5
Convergence\_25.tif 558300 559800 5994700 5995800 2.5
Convergence\_5.tif 558300 559800 5994700 5995800 2.5
dAH\_10.tif 558300 559800 5994700 5995800 2.5
dAH\_2.5.tif 558300 559800 5994700 5995800 2.5
dAH\_25.tif 558300 559800 5994700 5995800 2.5
dAH\_5.tif 558300 559800 5994700 5995800 2.5
difinsol\_10.tif 558300 559800 5994700 5995800 2.5
difinsol\_2.5.tif 558300 559800 5994700 5995800 2.5
difinsol\_25.tif 558300 559800 5994700 5995800 2.5
difinsol\_5.tif 558300 559800 5994700 5995800 2.5
dirinsol\_10.tif 558300 559800 5994700 5995800 2.5
dirinsol\_2.5.tif 558300 559800 5994700 5995800 2.5
dirinsol\_25.tif 558300 559800 5994700 5995800 2.5
dirinsol\_5.tif 558300 559800 5994700 5995800 2.5
dtm\_10.tif 558300 559800 5994700 5995800 2.5
dtm\_2.5.tif 558300 559800 5994700 5995800 2.5
dtm\_25.tif 558300 559800 5994700 5995800 2.5
dtm\_5.tif 558300 559800 5994700 5995800 2.5
Filled\_sinks\_10.tif 558300 559800 5994700 5995800 2.5
Filled\_sinks\_2.5.tif 558300 559800 5994700 5995800 2.5
Filled\_sinks\_25.tif 558300 559800 5994700 5995800 2.5
Filled\_sinks\_5.tif 558300 559800 5994700 5995800 2.5
gCurvature\_10.tif 558300 559800 5994700 5995800 2.5
gCurvature\_2.5.tif 558300 559800 5994700 5995800 2.5
gCurvature\_25.tif 558300 559800 5994700 5995800 2.5
gCurvature\_5.tif 558300 559800 5994700 5995800 2.5
MRRTF\_10.tif 558300 559800 5994700 5995800 2.5
MRRTF\_2.5.tif 558300 559800 5994700 5995800 2.5
MRRTF\_25.tif 558300 559800 5994700 5995800 2.5
MRRTF\_5.tif 558300 559800 5994700 5995800 2.5
MRVBF\_10.tif 558300 559800 5994700 5995800 2.5
MRVBF\_2.5.tif 558300 559800 5994700 5995800 2.5
MRVBF\_25.tif 558300 559800 5994700 5995800 2.5
MRVBF\_5.tif 558300 559800 5994700 5995800 2.5
OpennessNegative\_10.tif 558300 559800 5994700 5995800 2.5
OpennessNegative\_2.5.tif 558300 559800 5994700 5995800 2.5
OpennessNegative\_25.tif 558300 559800 5994700 5995800 2.5
OpennessNegative\_5.tif 558300 559800 5994700 5995800 2.5
OpennessPositive\_10.tif 558300 559800 5994700 5995800 2.5
OpennessPositive\_2.5.tif 558300 559800 5994700 5995800 2.5
OpennessPositive\_25.tif 558300 559800 5994700 5995800 2.5
OpennessPositive\_5.tif 558300 559800 5994700 5995800 2.5
OverlandFlowDistance\_10.tif 558300 559800 5994700 5995800 2.5
OverlandFlowDistance\_2.5.tif 558300 559800 5994700 5995800 2.5
OverlandFlowDistance\_25.tif 558300 559800 5994700 5995800 2.5
OverlandFlowDistance\_5.tif 558300 559800 5994700 5995800 2.5
Slope\_10.tif 558300 559800 5994700 5995800 2.5
Slope\_2.5.tif 558300 559800 5994700 5995800 2.5
Slope\_25.tif 558300 559800 5994700 5995800 2.5
Slope\_5.tif 558300 559800 5994700 5995800 2.5
Specific\_Catchment\_10.tif 558300 559800 5994700 5995800 2.5
Specific\_Catchment\_2.5.tif 558300 559800 5994700 5995800 2.5
Specific\_Catchment\_25.tif 558300 559800 5994700 5995800 2.5
Specific\_Catchment\_5.tif 558300 559800 5994700 5995800 2.5
tCatchment\_10.tif 558300 559800 5994700 5995800 2.5
tCatchment\_2.5.tif 558300 559800 5994700 5995800 2.5
tCatchment\_25.tif 558300 559800 5994700 5995800 2.5
tCatchment\_5.tif 558300 559800 5994700 5995800 2.5
tCurve\_10.tif 558300 559800 5994700 5995800 2.5
tCurve\_2.5.tif 558300 559800 5994700 5995800 2.5
tCurve\_25.tif 558300 559800 5994700 5995800 2.5
tCurve\_5.tif 558300 559800 5994700 5995800 2.5
TPI\_10.tif 558300 559800 5994700 5995800 2.5
TPI\_2.5.tif 558300 559800 5994700 5995800 2.5
TPI\_25.tif 558300 559800 5994700 5995800 2.5
TPI\_5.tif 558300 559800 5994700 5995800 2.5
TRI\_10.tif 558300 559800 5994700 5995800 2.5
TRI\_2.5.tif 558300 559800 5994700 5995800 2.5
TRI\_25.tif 558300 559800 5994700 5995800 2.5
TRI\_5.tif 558300 559800 5994700 5995800 2.5
TWI\_10.tif 558300 559800 5994700 5995800 2.5
TWI\_2.5.tif 558300 559800 5994700 5995800 2.5
TWI\_25.tif 558300 559800 5994700 5995800 2.5
TWI\_5.tif 558300 559800 5994700 5995800 2.5
VerticalDistance\_10.tif 558300 559800 5994700 5995800 2.5
VerticalDistance\_2.5.tif 558300 559800 5994700 5995800 2.5
VerticalDistance\_25.tif 558300 559800 5994700 5995800 2.5
VerticalDistance\_5.tif 558300 559800 5994700 5995800 2.5

As a final test a raster stack() is created –Success!

cvs <- stack(l)

names(cvs)
##  [1] "Aspect_2.5"               "Channel_network_grid_2.5"
##  [3] "Convergence_2.5"          "dAH_2.5"                 
##  [5] "difinsol_2.5"             "dirinsol_2.5"            
##  [7] "dtm_2.5"                  "Filled_sinks_2.5"        
##  [9] "gCurvature_2.5"           "MRRTF_2.5"               
## [11] "MRVBF_2.5"                "OpennessNegative_2.5"    
## [13] "OpennessPositive_2.5"     "OverlandFlowDistance_2.5"
## [15] "Slope_2.5"                "Specific_Catchment_2.5"  
## [17] "tCatchment_2.5"           "tCurve_2.5"              
## [19] "TPI_2.5"                  "TRI_2.5"                 
## [21] "TWI_2.5"                  "VerticalDistance_2.5"    
## [23] "Aspect_10"                "Aspect_25"               
## [25] "Aspect_5"                 "Channel_network_grid_10" 
## [27] "Channel_network_grid_25"  "Channel_network_grid_5"  
## [29] "Convergence_10"           "Convergence_25"          
## [31] "Convergence_5"            "dAH_10"                  
## [33] "dAH_25"                   "dAH_5"                   
## [35] "difinsol_10"              "difinsol_25"             
## [37] "difinsol_5"               "dirinsol_10"             
## [39] "dirinsol_25"              "dirinsol_5"              
## [41] "dtm_10"                   "dtm_25"                  
## [43] "dtm_5"                    "Filled_sinks_10"         
## [45] "Filled_sinks_25"          "Filled_sinks_5"          
## [47] "gCurvature_10"            "gCurvature_25"           
## [49] "gCurvature_5"             "MRRTF_10"                
## [51] "MRRTF_25"                 "MRRTF_5"                 
## [53] "MRVBF_10"                 "MRVBF_25"                
## [55] "MRVBF_5"                  "OpennessNegative_10"     
## [57] "OpennessNegative_25"      "OpennessNegative_5"      
## [59] "OpennessPositive_10"      "OpennessPositive_25"     
## [61] "OpennessPositive_5"       "OverlandFlowDistance_10" 
## [63] "OverlandFlowDistance_25"  "OverlandFlowDistance_5"  
## [65] "Slope_10"                 "Slope_25"                
## [67] "Slope_5"                  "Specific_Catchment_10"   
## [69] "Specific_Catchment_25"    "Specific_Catchment_5"    
## [71] "tCatchment_10"            "tCatchment_25"           
## [73] "tCatchment_5"             "tCurve_10"               
## [75] "tCurve_25"                "tCurve_5"                
## [77] "TPI_10"                   "TPI_25"                  
## [79] "TPI_5"                    "TRI_10"                  
## [81] "TRI_25"                   "TRI_5"                   
## [83] "TWI_10"                   "TWI_25"                  
## [85] "TWI_5"                    "VerticalDistance_10"     
## [87] "VerticalDistance_25"      "VerticalDistance_5"