library(landscapemetrics)
library(landscapetools)
library(raster)
library(tidyverse)
library(janitor)
esett <- raster("data/esett.asc")
psett <- raster("data/psett.asc")
show_landscape(esett,discrete = TRUE)

show_landscape(psett,discrete = TRUE)

fig.cap='Figure 1. Early settlement (left) and post settlement (right) raster maps.'

#Add code importing esett and psett rasters here

Figure 1. Early settlement (top) and post settlement (bottom) raster maps

Task 1: Landscape composition

Task 1.1 Calculate the total area of each class and use this to calculate the proportion of each class type in each landscape. Summarise in Table 1.1a and 1.1b (2 pts). You may want to switch to the Visual Editor to fill in these tables.

esett_classes <-calculate_lsm(esett,
                              what = c("lsm_c_ca"))
## Warning: Please use 'check_landscape()' to ensure the input data is valid.
esett_classes
## # A tibble: 3 × 6
##   layer level class    id metric value
##   <int> <chr> <int> <int> <chr>  <dbl>
## 1     1 class     1    NA ca        59
## 2     1 class     2    NA ca        28
## 3     1 class     3    NA ca        13
psett_classes <-calculate_lsm(psett,
                              what = c("lsm_c_ca"))
## Warning: Please use 'check_landscape()' to ensure the input data is valid.
psett_classes
## # A tibble: 3 × 6
##   layer level class    id metric value
##   <int> <chr> <int> <int> <chr>  <dbl>
## 1     1 class     1    NA ca        39
## 2     1 class     2    NA ca        32
## 3     1 class     3    NA ca        29

Table 1.1a – Early Settlement

Cover type Cells Pi
Forested 59 0.59
Agricultural 28 0.28
Urban 13 0.13
————— ——- ——-
Total

Table 1.1b – Post Settlement

Cover type Cells Pi
Forested 39 0.39
Agricultural 32 0.32
Urban 29 0.29
————— ——— ——-
Total

Task 1.2 Calculate Dominance: S is the number of land cover types Pi is the proportion of the ith land cover type. Values near 1 indicate the landscape is dominated by one land cover type; a value of zero means all cover types are equally abundant. Do this using the equation below. Summarise in Table 2 (2 pts).

Hint: use the log() and sum() functions to recreate this function in R.

esett_dominance <- (log(3) + ((0.59*log(0.59))+(0.28*log(0.28))+(0.13*log(0.13))))/log(3)
esett_dominance
## [1] 0.150781
psett_dominance <- (log(3) + ((0.39*log(0.39))+(0.32*log(0.32))+(0.29*log(0.29))))/log(3)
psett_dominance
## [1] 0.007083868

Task 1.3 Using the landscapemetrics package in R calculate the Shannon’s Evenness Index: Values near 0 indicate the landscape is dominated by one land cover type; a value of 1 means all cover types are equally abundant. It is a measure of dominance. Summarise in Table 2 (2 pts).

esett_evenness <-calculate_lsm(esett,
                              what = c("lsm_l_shei"))
## Warning: Please use 'check_landscape()' to ensure the input data is valid.
esett_evenness
## # A tibble: 1 × 6
##   layer level     class    id metric value
##   <int> <chr>     <int> <int> <chr>  <dbl>
## 1     1 landscape    NA    NA shei   0.849
psett_evenness <-calculate_lsm(psett,
                              what = c("lsm_l_shei"))
## Warning: Please use 'check_landscape()' to ensure the input data is valid.
psett_evenness
## # A tibble: 1 × 6
##   layer level     class    id metric value
##   <int> <chr>     <int> <int> <chr>  <dbl>
## 1     1 landscape    NA    NA shei   0.993

Table 1.3

Metric Pre-Settlement Post-settlement
Dominance 0.150781 0.007083868
Shannon’s Evenness Index 0.849219 0.9929161

Question 1.4 What is the relationship between Dominance and Shannon’s Evenness Index? Do you need to analyse both (1 pts)?

The Dominance metric is the exact inverse of Shannon’s Evenness Index. The subtraction of Shannon’s Evenness Index from the value of 1 will result in the Dominance metric. This means that both the Dominance metric and Shannon’s Evenness Index both represent the proportin of land cover types in a landscape in exactly the same way, and both metrics do not need to be analysed to represent proportions of land cover types in a landscape. The calculation of either the Dominance metric or Shannon’s Evenness Index will suffice.

Question 1.5 How would you interpret/describe the changes in this landscape between the two time periods (2 pts)?

Using the Dominance metric, the difference in landscape between the two time periods can be seen. Higher Dominance values (the maximum Dominance value being 1) means that a landscape is more homogeneous, or dominated by one land cover type. Lower Dominance values (the minimum Dominance value being 0) means that land cover types within a landscape are equally abundant, or the landscape is more heterogeneous.

It can be seen from the results that the Pre-Settlement landscape has a higher Dominance value (0.150781) than the Post-Settlement landscape (0.00708). This means that the Pre-Settlement landscape is more homogenous and more dominated by a single land cover type. It also means that the Post-Settlement landscape is more hetergenous.

This is confirmed by Table 1.1a and 1.1b. It can be seen that the Pre-Settlement landscape is largely dominated by a forested land cover type (Pi = 0.59). However, the Post-Settlement landscape has close-to equal abundance of forested (Pi = 0.39), agricultural (Pi = 0.32) and urban (Pi = 0.29) land cover types.

Task 1.6 Using Table 1.6 below calculate Shannon’s Evenness Index for each landscape. You will use these to answer the next questions in your notebook (2 pts).

W_dominance <- (log(3) + ((0.1*log(0.1))+(0.8*log(0.8))+(0.1*log(0.1))))/log(3)
W_shei <- 1-W_dominance
W_shei
## [1] 0.5816719
X_dominance <- (log(3) + ((0.8*log(0.8))+(0.1*log(0.1))+(0.1*log(0.1))))/log(3)
X_shei <- 1-X_dominance
X_shei
## [1] 0.5816719
Y_dominance <- (log(3) + ((0.65*log(0.65))+(0.2*log(0.2))+(0.15*log(0.15))))/log(3)
Y_shei <- 1-Y_dominance
Y_shei
## [1] 0.8068947
Z_dominance <- (log(3) + ((0.15*log(0.15))+(0.2*log(0.2))+(0.65*log(0.65))))/log(3)
Z_shei <- 1-Z_dominance
Z_shei
## [1] 0.8068947

Table 1.6

Landscape Pforest Pagricultural Purban Shannon’s Evenness Index
W 0.1 0.8 0.1 0.5816719
X 0.8 0.1 0.1 0.5816719
Y 0.65 0.2 0.15 0.8068947
Z 0.15 0.2 0.65 0.8068947

Question 1.7 Which of these hypothetical landscapes might be considered “similar” when only comparing Shannon Evenness Index (SHEI)? Considering your interpretation of the data in Table 3, what other types of information and/or metrics would be necessary to distinguish these landscapes? (4 pts)

When only using Shannon’s Evenness Index to analyse these landscapes, it would be assumed that:

  1. Landscapes W and X are similar landscapes
  2. Landscapes Y and Z are similar landscapes

This is because landscapes W and X have the same Shannon’s Evenness Index value, as do landscapes Y and Z. In order to gain a more representative understanding of the composition of these landscapes, total class area (lsm_c_ca) would give an indication on the area of land cover types within the landscape, indicating which land cover types (forest, agricultural, urban) are more dominant than others in the hypothetical landscapes.

Additionally, an ‘Area and Edge metric’ (AREA_MN) would provide a summary of each class/land cover type as the average of all the patch areas belonging to that class/land cover type, thus providing a more detailed indication of the composition of the landscape and patch structure. As it would show the average area of a class/land cover type patch, with use in tandem with the total class area, the patch structure (ie. few large patches or many small patches) could be inferred.

Task 2: Landscape structure

Task 2.1 Using the landscapemetrics package in R calculate the Number of Patches and Mean Patch Size for each landscape and summarise in Table 2.1 (4 pts).

esett_patches <-calculate_lsm(esett,
                              what = c("lsm_c_np",
                                        "lsm_c_area_mn"),
                              directions = 4)
## Warning: Please use 'check_landscape()' to ensure the input data is valid.
esett_patches
## # A tibble: 6 × 6
##   layer level class    id metric  value
##   <int> <chr> <int> <int> <chr>   <dbl>
## 1     1 class     1    NA area_mn  8.43
## 2     1 class     2    NA area_mn  1.75
## 3     1 class     3    NA area_mn  1.3 
## 4     1 class     1    NA np       7   
## 5     1 class     2    NA np      16   
## 6     1 class     3    NA np      10
psett_patches <-calculate_lsm(psett,
                              what = c("lsm_c_np",
                                        "lsm_c_area_mn"),
                              directions = 4)
## Warning: Please use 'check_landscape()' to ensure the input data is valid.
psett_patches
## # A tibble: 6 × 6
##   layer level class    id metric  value
##   <int> <chr> <int> <int> <chr>   <dbl>
## 1     1 class     1    NA area_mn  3   
## 2     1 class     2    NA area_mn  1.68
## 3     1 class     3    NA area_mn  1.53
## 4     1 class     1    NA np      13   
## 5     1 class     2    NA np      19   
## 6     1 class     3    NA np      19

Table 2.1

Class type # patches - Early # patches - Post Mean patch size - Early Mean patch size - Post
Forested 7.000000 13.000000 8.428571 3.000000
Agricultural 16.000000 19.000000 1.750000 1.684211
Urban 10.000000 19.000000 1.300000 1.526316

Question 2.2 What characteristics of a landscape do the number of patches and the average patch size represent (2 pts)?

Generally, the number of patches and average patch size represents a quantification of landscape composition. Landscape composition can be thought of as an identification of what elements make up the landscape, as well as how much of each element exists in the landscape. Landscape composition can be quantified by patch number/size to describe a range of landscape characteristics, such as:

As defined in Lecture 1b:

The number of patches and average patch size represents the landscape characteristics of hetergeneity/homogeneity, as the patchy landscapes are landscapes with many boundaries that would otherwise be assumed to be homogenous.

It also infers the connectivity of a landscape, as highly patchy landscapes with a high number of small patches can be assumed or inferred to have low connectivity, or spatial continuity of a habitat. The opposite characteristic would be fragmentation.

The number of patches and average patch size can also infer the number of edges within a landscape, or the area of habitat between two habitat or land cover types.

Task 2.3 You will also need to calculate the edge/area ratio (i.e. Number of Edges of class I /Total Area of class I) for each class for both the early and post settlement time periods. You can do this manually based on the outputs from the code above. Summarise these in Table 2.3 (4 pts).

#Task 2.3 code here

esett_edges <-calculate_lsm(esett,
                              what = c("lsm_c_ed",
                                       "lsm_c_ca"), 
                              directions = 4)
## Warning: Please use 'check_landscape()' to ensure the input data is valid.
esett_edges
## # A tibble: 6 × 6
##   layer level class    id metric value
##   <int> <chr> <int> <int> <chr>  <dbl>
## 1     1 class     1    NA ca        59
## 2     1 class     2    NA ca        28
## 3     1 class     3    NA ca        13
## 4     1 class     1    NA ed        89
## 5     1 class     2    NA ed        75
## 6     1 class     3    NA ed        40
psett_edges <-calculate_lsm(psett,
                              what = c("lsm_c_ed",
                                       "lsm_c_ca"), 
                              directions = 4)
## Warning: Please use 'check_landscape()' to ensure the input data is valid.
psett_edges
## # A tibble: 6 × 6
##   layer level class    id metric value
##   <int> <chr> <int> <int> <chr>  <dbl>
## 1     1 class     1    NA ca        39
## 2     1 class     2    NA ca        32
## 3     1 class     3    NA ca        29
## 4     1 class     1    NA ed        84
## 5     1 class     2    NA ed        83
## 6     1 class     3    NA ed        85
edge_area_ratio_esett_1 <- 89/59
edge_area_ratio_esett_2 <- 75/28
edge_area_ratio_esett_3 <- 40/13
edge_area_ratio_psett_1 <- 84/39
edge_area_ratio_psett_2 <- 83/32
edge_area_ratio_psett_3 <- 85/29

edge_area_ratio_esett_1
## [1] 1.508475
edge_area_ratio_esett_2
## [1] 2.678571
edge_area_ratio_esett_3
## [1] 3.076923
edge_area_ratio_psett_1
## [1] 2.153846
edge_area_ratio_psett_2
## [1] 2.59375
edge_area_ratio_psett_3
## [1] 2.931034

Table 2.3

Class type Number of Edges- Early Number of Edges - Post Edge:Area Ratio- Early Edge:Area Ratio - Post
Forested 89 84 1.508475 2.153846
Agricultural 75 83 2.678571 2.59375
Urban 40 85 3.076923 2.931034

Question 2.4 Two landscapes are the same size and both contain the same amount of a given cover type. Landscape A has four patches of that cover type, and Landscape B has 17 patches of the same cover type. Which of the landscapes will have the higher edge to area ratio of that cover type (1 pt)?

As the two landscapes both contain the same amount of a given cover type, it can be inferred that Landscape A has few, large patches of the given cover type while Landscape B has many, smaller patches of the given cover type.

The number of patches of a given cover type in a landscape impacts the relative abundance of edge. The edge to interior area ration will decrease as the patch size increases.

Therefore, Landscape B would have the higher edge to area ratio. As area is held constant, the landscape with the greater number of patches (Landscape B) would have the greater number of edges, and therefore the higher edge to area ratio.

Task 2.5 Use landscapemetrics package in R to calculate contagion and summarise in Table 2.5 (2 pts).

#Task 2.5 code here

esett_contagion <-calculate_lsm(esett,
                              what = c("lsm_l_contag"),
                              directions = 4)
## Warning: Please use 'check_landscape()' to ensure the input data is valid.
esett_contagion
## # A tibble: 1 × 6
##   layer level     class    id metric value
##   <int> <chr>     <int> <int> <chr>  <dbl>
## 1     1 landscape    NA    NA contag  15.8
psett_contagion <-calculate_lsm(psett,
                              what = c("lsm_l_contag"),
                              directions = 4)
## Warning: Please use 'check_landscape()' to ensure the input data is valid.
psett_contagion
## # A tibble: 1 × 6
##   layer level     class    id metric value
##   <int> <chr>     <int> <int> <chr>  <dbl>
## 1     1 landscape    NA    NA contag  1.62

Table 2.5

Cover Type Pre-Settlement Post-Settlement
Contagion 15.78093 1.620834

Question 2.6 What does the contagion value tell you about changes in landscape structure over time (2 pts)?

Contagion is a metric that provides one measure of the configuration of a landscape. Landscape configuration can be thought of as a range of measures describing or quantifying how the elements of a landscape are arranged, what shapes the patches or elements take in a landscape, and how these elements or patches spatially relate to each other.

Contagion is an index that quantifies the level of aggregation of patches by cover type within a landscape. Plainly speaking, contagion is a measure of how “mixed” or “clumped” patches are by cover type within a landscape. Landscapes with low contagion indices are made up of patches that are “well-mixed” or not very aggregated, whereas landscapes with high contagion indicies are made up of highly aggregated landscape elements or patches.

As shown by the contagion values in Table 2.5, the Pre-Settlement landscape has a higher contagion value and the Post-Settlement landscape has a lower contagion value. Pre-Settlement landscape was much more aggregated by cover type than the Post-Settlement landscape. The Post-Settlement landscape has cover types or patches which are much more well-mixed with each other. The shows that over time, the patches has been decreasing in size and losing aggregation.

Task 3: Neighbourhood rules

Task 3.1 Adapt the provided code to calculate the suite of landscape metrics for both neighbourhood rules. Once you have created four objects with each set of metrics, you can use the provided code to bind them into a table. Put all of your code here: (4 pts):

#Paste task 3.1 code here

esett_4 <-calculate_lsm(esett,
                              what = c("lsm_c_ca",
                                       "lsm_c_np",
                                       "lsm_c_area_mn",
                                       "lsm_c_ed",
                                       "lsm_l_shdi",
                                       "lsm_l_contag"),
                              directions = 4)
## Warning: Please use 'check_landscape()' to ensure the input data is valid.
esett_4$layer <- "esett4"

psett_4 <-calculate_lsm(psett,
                              what = c("lsm_c_ca",
                                       "lsm_c_np",
                                       "lsm_c_area_mn",
                                       "lsm_c_ed",
                                       "lsm_l_shdi",
                                       "lsm_l_contag"),
                              directions = 4)
## Warning: Please use 'check_landscape()' to ensure the input data is valid.
psett_4$layer <- "psett4"

esett_8 <-calculate_lsm(esett,
                              what = c("lsm_c_ca",
                                       "lsm_c_np",
                                       "lsm_c_area_mn",
                                       "lsm_c_ed",
                                       "lsm_l_shdi",
                                       "lsm_l_contag"),
                              directions = 8)
## Warning: Please use 'check_landscape()' to ensure the input data is valid.
esett_8$layer <- "esett8"

psett_8 <-calculate_lsm(psett,
                              what = c("lsm_c_ca",
                                       "lsm_c_np",
                                       "lsm_c_area_mn",
                                       "lsm_c_ed",
                                       "lsm_l_shdi",
                                       "lsm_l_contag"),
                              directions = 8)
## Warning: Please use 'check_landscape()' to ensure the input data is valid.
psett_8$layer <- "psett8"

allmetrics <- list(esett_4, esett_8, psett_4, psett_8)
metric_table <- do.call(rbind, allmetrics)
metric_table <- tidyr::spread(metric_table, layer, value)

[Table 3.1

This will be your metrics table. You can print it in an intuitive order using this code:

#Paste table 3.1 code here

metric_table[order(metric_table$level, metric_table$metric),]
## # A tibble: 14 × 8
##    level     class    id metric  esett4 esett8 psett4 psett8
##    <chr>     <int> <int> <chr>    <dbl>  <dbl>  <dbl>  <dbl>
##  1 class         1    NA area_mn  8.43  59       3     19.5 
##  2 class         2    NA area_mn  1.75   3.5     1.68   3.56
##  3 class         3    NA area_mn  1.3    1.86    1.53   4.14
##  4 class         1    NA ca      59     59      39     39   
##  5 class         2    NA ca      28     28      32     32   
##  6 class         3    NA ca      13     13      29     29   
##  7 class         1    NA ed      89     89      84     84   
##  8 class         2    NA ed      75     75      83     83   
##  9 class         3    NA ed      40     40      85     85   
## 10 class         1    NA np       7      1      13      2   
## 11 class         2    NA np      16      8      19      9   
## 12 class         3    NA np      10      7      19      7   
## 13 landscape    NA    NA contag  15.8   15.8     1.62   1.62
## 14 landscape    NA    NA shdi     0.933  0.933   1.09   1.09

Question 3.2 What metrics changed between the two neighbourhood rules and what does this mean (4 pts)?

How a patch and/or landscape is defined will depend heavily on the rules or approaches to quanitify it. An example of this is neighbourhood rules, where different neighbourhood rules with different weighting will affect edge indices. For example, assuming a constant landscape area and grain size, a 4-neighbourhood rule will estimate a higher number of patches than an 8-nighbourhood rule.

In Table 3.1, a selection of class metrics and landscape metrics were calculated. Some class metric values remained the same across landscapes irrespective of whether they were calculated with a 4- or 8-neighbourhood rule. However, some class metric values changed across landscapes depending on whether they were calculated with a 4- or 8-neighbourhood rule. The landscape metrics both remained constant across landscapes, irrespective of which neighbourhood rule was used to calculate them.

The class metrics which remained constant were:

The class metric values which changed according to neighbourhood rule were:

The landscape metrics of contagion and Shannon’s Diversity Index (combined measure of number of classes and the abundance of each class) remained the same.

This means, that considering which elements remained constant and which elements changes depending on the neighbourhoold rule used, that generally speaking, the neighbourhood rule selected for analysis will not impact the quantification of landscape composition, but may impact the quantification of landscape configuration.

Task 4: Real maps

Task 4.1 Create maps (show_landscape code) in R for each landscapes (2 pts).

pre_fire <- raster("data/pre_fire.grd")
## Warning in .rasterFromRasterFile(grdfile, band = band, objecttype, ...): NAs
## introduced by coercion
show_landscape(pre_fire, discrete = TRUE)
Pre fire

Pre fire

post_fire <- raster("data/post_fire.grd")
## Warning in .rasterFromRasterFile(grdfile, band = band, objecttype, ...): NAs
## introduced by coercion
show_landscape(post_fire, discrete = TRUE) 
Post fire

Post fire

Question 4.2 What is the extent and grain for the landscape (2 pts)?

Landscape extent (ncell) = 194892

Landscape grain/resolution = 100, 100 (x, y)

This values are held constant for both pre fire and post fire landscapes.

Task 5: Landscape metrics

Question 5.1 What do each of the metrics mean (include interpretations!)? (6 pts)

Both metrics are a component of scale. The extent is referring to the spatial area of the landscape. The grain or resolution is referring to the smallest area within a defined landscape that has data available, and can indicate the heterogeneity of a landscape across a spatial scale.

The Pre Fire and Post Fire landscapes have a spatial scale or landscape extent of 194,892 cells. For these purposes, cells are a measure of spatial area, like m2. These landscapes also have a landscape resolution of 100 by 100. This means that there is data available in these landscapes in cell/grid sizes of 100 length and 100 width. For example, if the landscape grain was 100m by 100m, there would be data available, recorded and categorised per 10,000m2 area.

Task 6: Plotting Landscape metrics

Task 6.1 For each metric, graph using a bar graph (metric on the Y-axis, landscape on the X-axis); your plots will have two, one for each landscape (4 pts).

#Task 6.1 code here

land1<- raster("data/pre_fire.grd")
## Warning in .rasterFromRasterFile(grdfile, band = band, objecttype, ...): NAs
## introduced by coercion
land1_mets <-calculate_lsm(land1, 
                           what = c("lsm_l_contag", #Contagion
                                    "lsm_l_pd", #Patch density
                                    "lsm_l_ed", #Edge density
                                    "lsm_l_lsi", #landscape shape index
                                    "lsm_l_lpi", #Largest patch index
                                    "lsm_l_pr"), #Patch richness
                           directions = 8)
land1_mets$layer <- "pre" #This gives the layer a name associated with the landscape so we can bind them!

land2<- raster("data/post_fire.grd")
## Warning in .rasterFromRasterFile(grdfile, band = band, objecttype, ...): NAs
## introduced by coercion
land2_mets <-calculate_lsm(land2, 
                           what = c("lsm_l_contag", #Contagion
                                    "lsm_l_pd", #Patch density
                                    "lsm_l_ed", #Edge density
                                    "lsm_l_lsi", #landscape shape index
                                    "lsm_l_lpi", #Largest patch index
                                    "lsm_l_pr"), #Patch richness
                           directions = 8)
land2_mets$layer <- "post" #This gives the layer a name associated with the landscape so we can bind them!

allmetrics <- list(land1_mets, land2_mets) #This creates a list of the data tables
metric_table <- do.call(rbind, allmetrics) #This binds the tables together
allmetrics
## [[1]]
## # A tibble: 6 × 6
##   layer level     class    id metric value
##   <chr> <chr>     <int> <int> <chr>  <dbl>
## 1 pre   landscape    NA    NA contag 58.2 
## 2 pre   landscape    NA    NA ed     26.3 
## 3 pre   landscape    NA    NA lpi    50.8 
## 4 pre   landscape    NA    NA lsi    27.7 
## 5 pre   landscape    NA    NA pd      1.23
## 6 pre   landscape    NA    NA pr      7   
## 
## [[2]]
## # A tibble: 6 × 6
##   layer level     class    id metric value
##   <chr> <chr>     <int> <int> <chr>  <dbl>
## 1 post  landscape    NA    NA contag 49.6 
## 2 post  landscape    NA    NA ed     32.4 
## 3 post  landscape    NA    NA lpi    50.8 
## 4 post  landscape    NA    NA lsi    33.7 
## 5 post  landscape    NA    NA pd      2.40
## 6 post  landscape    NA    NA pr      7
#library(ggplot2)
p <- ggplot(data = metric_table, mapping = aes(x = as.factor(layer), y = value))
p + geom_bar(stat = "identity") + 
  facet_wrap(~metric, scales = "free") +
  xlab("Landscape") +
  ggtitle("Landscape level metrics for the pre- and post-fire landscapes")

Question 6.2 Which of the landscapes is the most fragmented, and which appears least fragmented? How did you determine this? (3 pts)

Fragmentation refers to the phenomena of a large patch/habitat/land cover type transforming into a number of smaller patches/habitats/land cover types that are not as spatially connected to each other, if at all (as they were in their former state).

Patch density (‘pd’) is a metric which describes fragmentation. The patch density metric value increases as the landscape gets more fragmented or patchy. As such, it appears that the post fire landscape is more fragmented than the pre fire landscape.

This is also supported by the contagion metric value (‘contag’). Although not a direct measure of fragmentation like patch density, contagion is a metric of aggregation, which is a metric of cell adjacencies, measuring the probability of two random cells belonging to the same class. In addition to patch density, this can be used to infer the dispersion of class types. Low class dispersion (high contagion value) could infer low fragmentation, or a high proportion of like cell adjacency. The pre fire landscape also has a higher contagion value than the post fire landscape, indicating low class type patch dispersion.

Question 6.3 : How would the correlation among landscape metrics influence your choice of what to report in an analysis that describes landscape pattern? (3 pts)

All these metrics can be categorised by their function, as either metrics for Aggregation, Area and Edge or Diversity. Generally speaking, metrics which share the same function will be correlated with each other, and therefore not all metrics within the same function group need to be analysed in a landscape.

The following metrics are categorised by the following functions:

In this example, all the aggregation functions are correlated, and do not need to be simultaneously analysed. In this particular example, although an area and edge metric, edge density is also correlated with the aggregation functions, which highlights the need to understand what the metric is describing in order to appropriately select metrics.

As such, in this example, the following metrics would be selected for analysis to describe the landscape:

  1. One of contagion, patch density, landscape shape index or edge density

  2. Largest patch index

  3. Patch richness

Task 7 - Landscape Change Over Time

Task 7.1 Generate bar graphs for these class metrics (4 pts):

  1. Patch Density

  2. Edge Density

  3. Landscape Shape Index

  4. Largest Patch Index

Hint You can use the code from previous questions to calculate your metrics and put together your table.

#Task 7 code here

land1<- raster("data/pre_fire.grd")
## Warning in .rasterFromRasterFile(grdfile, band = band, objecttype, ...): NAs
## introduced by coercion
land1_mets <-calculate_lsm(land1, 
                           what = c(
                                    "lsm_c_pd", #Patch density
                                    "lsm_c_ed", #Edge density
                                    "lsm_c_lsi", #landscape shape index
                                    "lsm_c_lpi" #Largest patch index
                                    ),
                           directions = 8)
land1_mets$layer <- "pre" #This gives the layer a name associated with the landscape so we can bind them!

land2<- raster("data/post_fire.grd")
## Warning in .rasterFromRasterFile(grdfile, band = band, objecttype, ...): NAs
## introduced by coercion
land2_mets <-calculate_lsm(land2, 
                           what = c(
                                    "lsm_c_pd", #Patch density
                                    "lsm_c_ed", #Edge density
                                    "lsm_c_lsi", #landscape shape index
                                    "lsm_c_lpi" #Largest patch index
                                    ),
                           directions = 8)
land2_mets$layer <- "post" #This gives the layer a name associated with the landscape so we can bind them!

allmetrics <- list(land1_mets, land2_mets) #This creates a list of the data tables
metric_table <- do.call(rbind, allmetrics) #This binds the tables together
allmetrics
## [[1]]
## # A tibble: 28 × 6
##    layer level class    id metric   value
##    <chr> <chr> <int> <int> <chr>    <dbl>
##  1 pre   class     1    NA ed      3.10  
##  2 pre   class     2    NA ed     18.9   
##  3 pre   class     3    NA ed      0.205 
##  4 pre   class     4    NA ed      2.32  
##  5 pre   class     5    NA ed     14.6   
##  6 pre   class     6    NA ed     12.8   
##  7 pre   class     7    NA ed      0.562 
##  8 pre   class     1    NA lpi     0.0642
##  9 pre   class     2    NA lpi    15.9   
## 10 pre   class     3    NA lpi     0.0178
## # … with 18 more rows
## 
## [[2]]
## # A tibble: 28 × 6
##    layer level class    id metric   value
##    <chr> <chr> <int> <int> <chr>    <dbl>
##  1 post  class     1    NA ed     15.7   
##  2 post  class     2    NA ed     11.0   
##  3 post  class     3    NA ed      1.23  
##  4 post  class     4    NA ed      9.41  
##  5 post  class     5    NA ed     14.2   
##  6 post  class     6    NA ed     12.8   
##  7 post  class     7    NA ed      0.562 
##  8 post  class     1    NA lpi     5.73  
##  9 post  class     2    NA lpi     3.23  
## 10 post  class     3    NA lpi     0.0704
## # … with 18 more rows
p <- ggplot(data = metric_table, mapping = aes(fill = layer, x = factor(class), y = value))
p + geom_bar(position = "dodge", stat = "identity") +
  facet_wrap(~metric, scales = "free") +
  xlab("Class") +
  scale_fill_grey() +
  ggtitle("Landscape change: Before and after fire")

metric_table_wide <- tidyr::spread(metric_table, layer, value)
metric_table_wide <- metric_table_wide %>%
  mutate(percent_change = (post-pre)/pre)

metric_table_wide
## # A tibble: 28 × 7
##    level class    id metric    post     pre percent_change
##    <chr> <int> <int> <chr>    <dbl>   <dbl>          <dbl>
##  1 class     1    NA ed     15.7     3.10           4.06  
##  2 class     1    NA lpi     5.73    0.0642        88.3   
##  3 class     1    NA lsi    34.2    24.8            0.382 
##  4 class     1    NA pd      0.490   0.269          0.824 
##  5 class     2    NA ed     11.0    18.9           -0.417 
##  6 class     2    NA lpi     3.23   15.9           -0.797 
##  7 class     2    NA lsi    32.5    34.2           -0.0473
##  8 class     2    NA pd      0.417   0.287          0.455 
##  9 class     3    NA ed      1.23    0.205          5     
## 10 class     3    NA lpi     0.0704  0.0178         2.96  
## # … with 18 more rows

Question 7.2 : Based on the metrics how would you describe the change in the structure of each land cover class over time? Be thorough! (8 pts)

The changes in structure of land cover classes over time depended on the class type and landscape type. The following table describes how classes in the landscape changed in structure following a fire.

Number of classes which showed an increase in metric value post-fire Number of classes which showed a decrease in metric value post-fire Number of classes which showed no change in metric value post-fire
METRIC
Patch density 5 0 2
Edge density 3 2 2
Landscape shape index 4 1 2
Largest patch index 3 2 2

Classes 6 and 7 were the only classes to not experience any change in structure across the landscapes. This means that the only changes to landscape structure occurred for classes 1 to 5.

Within this context, the following generalised inferences can be made:

The combination of these metrics infers that, for the same landscape, before and after fire, the landscape became more fragmented, the landscape became less aggregated by class post fire, the patches became less compact post fire and the landscape also became more dominated by a particular land cover type post fire than pre fire.

This indicates that the fire fragmented the landscape and altered the land cover type configuration for classes 1 to 5.