Lab 6. Landscape Metrics

Quantifying landscape patterns

Data for this lab.

Download Lab6.zip from the course data archive on Zenodo and unzip it into a folder called data/Lab6/ in your project directory.

Background

Landscape ecologists are interested in patterns of ecosystems. Different processes give rise to different patterns, and different patterns can govern different processes. This reciprocal relationship between pattern and process led Pete McKinley (Senior Conservation Biologist with The Wilderness Society) to say, “pattern IS process”.

Look over some historical photo of the patterns that fire created on the west side of Mission Mountains and the ways that forest managers sometimes attempt to harvest timber and reduce fuels mimicking these natural patterns. The historical image is from the Confederated Salish Kootenai’s Division of Fish, Wildlife, Recreation, and Conservation and can be found here.

Photograph of Mount Ellis near Bozeman, Montana in winter, showing a patchwork pattern of conifer forest and open areas on the snow-covered slopes created by timber harvesting designed to mimic the heterogeneous mosaic of a mixed-severity fire regime.Photo by Travis Belote.

When we talk about patterns, sometimes we’re talking about patterns in data (i.e., histogram or frequency distribution of values or a distinct relationship between variables in a scatterplot). In landscape ecology, we’re typically referring to geographic patterns. In other words, “pattern” in landscape ecology usually refers to the distinct arrangement of ecological objects - be it individual organisms (e.g., how trees or elk are distributed in a given area) or broader land cover classes (e.g., forest patches of various sizes in a given area).

Landscape ecologists have developed metrics for quantify what is often visually apparent. These metrics can be focused on three distinct but related levels: (1) landscape metrics that characterize the full landscape, (2) class metrics that evaluate different types of classes (land cover types) individually, and (3) patch metrics that evaluate individual patches, which are identified by the adjacency of pixels with the same type (i.e., three forest pixels that share a boundary would be classified as a forest patch and be assigned a unique identifier at this level).

Three raster grids illustrating the three levels at which landscape metrics can be calculated. Left panel shows the full Landscape level with three cover types (forest in dark green, shrub in tan, and water in light blue) across the entire grid. Center panel shows the Class level where only the forest class is shown and metrics are calculated across all forest pixels regardless of patch identity. Right panel shows the Patch level where each individual forest patch is assigned a unique shade of green, treating disconnected forest patches as separate objects for metric calculation. Figure by Travis Belote.

Landscape metrics.

There are many landscape metrics, but they are often correlated with one another. Here, we will focus on 4 different landscape-scale metrics: the aggregation index, contagion, edge density, and landscape richness,

As a landscape metric, the aggregation index and contagion measure how clumped or dispersed like classes tend to be, which can also be correlated with edge density. Edge density can be assessed across the entire landscape or for individual classes (we will do both). Landscape diversity – in our case richness – measure how many different types are in an area. You can calculate other measures of diversity (Shannon-Wiener and evenness) too.

Eight raster grids illustrating four pairs of landscape metrics. Top pair shows High Aggregation (green and tan patches clustered together) versus Low Aggregation (same cover types dispersed randomly). Second pair shows High Contagion (large connected patches of each cover type) versus Low Contagion (fragmented intermixed patches). Third pair shows Low Edge Density (one large compact green patch with minimal perimeter) versus High Edge Density (many small patches of multiple cover types creating maximum boundary between them). Bottom pair shows Low Richness (only two cover types present) versus High Richness (five cover types including a distinctive red class). Figure by Travis Belote.

Class metrics.

Here, we will evaluate the percent of the landscape occupied by specific classes (e.g., evergreen forests), the number of patches, and an edge index (how much “edge” does a specific class possess).

Six raster grids illustrating three pairs of landscape metrics for a single forest class. Top pair shows Low Percentage of Landscape (small cluster of green cells in corner) versus High Percentage of Landscape (majority of cells are green). Middle pair shows Many Patches (16 individual single-cell green patches scattered across the grid) versus One Large Patch (same total area consolidated into one contiguous block). Bottom pair shows Low Edge (compact square green patch with minimal perimeter-to-area ratio) versus High Edge (same area arranged as three thin vertical strips maximizing boundary length). Figure by Travis Belote.

Patch metrics

For patch metrics, we will only investigate patch size distributions, which is a count of the number of patches of different sizes (i.e., a histogram of patch sizes). Landscapes can be characterized by a few large patches or sometimes many small patches and have a class occupy the same total area.

Two raster grids illustrating the difference between patch configurations with equal total area. Left panel shows One Large Patch where all green cells are connected in a single contiguous block occupying the left portion of the grid. Right panel shows Many Small Patches where the same total area is divided into 16 individual isolated single-cell patches scattered across the grid. Figure by Travis Belote.

Simulated landscapes

We will start by investigating these landscape metrics with simulated landscapes that I created using the NLMR package in R. The simulated landscapes were produced using a two-dimensional fractional Brownian motion landscape with five different fractal dimensions. These details are not important for our purposes here; I share them in case some are interested. Each of the five simulated landscape is composed of only two classes (we can think of them as forest and non-forest), has the same composition (i.e., 30% of the pixels are “forest”), but with different patterns. We explore the differences in these patterns.

Start by loading packages (install them if you need to), and bring in the simulated landscapes by reading the .tif files from the directory and stacking them with rast(). Plot the landscapes to see what they look like. Imagine that green is forest and grey is not forest.

Code
# Load packages (install if you need to)
library(terra)
library(sf)
library(FedData)
library(landscapemetrics)
library(mapview)
library(tidyverse)

# List files in the folder called "simulated landscapes"
# This is where I stored rasters i created in NLMR
simulated_landscapes <- list.files("data/Lab6/simulated_landscapes/", pattern = ".tif$", full.names = T)

# We can stack the simulated landscapes up using "rast" and directing R to the full
# file names
sim_Stack <- rast(simulated_landscapes)

# Plot and look at the simulated landscapes
# This will return maps of 5 simulated landscape where 30% of the pixels are green and their patterns are very different.
plot(sim_Stack, col = c("grey90", "darkgreen"))

Let’s first view all of the metrics that you can calculate in landscapemetrics.

Code
# List metrics in the package 
landscapemetrics::list_lsm()
# A tibble: 133 × 5
   metric name                                type           level function_name
   <chr>  <chr>                               <chr>          <chr> <chr>        
 1 area   patch area                          area and edge… patch lsm_p_area   
 2 cai    core area index                     core area met… patch lsm_p_cai    
 3 circle related circumscribing circle       shape metric   patch lsm_p_circle 
 4 contig contiguity index                    shape metric   patch lsm_p_contig 
 5 core   core area                           core area met… patch lsm_p_core   
 6 enn    euclidean nearest neighbor distance aggregation m… patch lsm_p_enn    
 7 frac   fractal dimension index             shape metric   patch lsm_p_frac   
 8 gyrate radius of gyration                  area and edge… patch lsm_p_gyrate 
 9 ncore  number of core areas                core area met… patch lsm_p_ncore  
10 para   perimeter-area ratio                shape metric   patch lsm_p_para   
# ℹ 123 more rows

That’s a lot of metrics! Recall the advice from Turner and Gardiner (2015), “Just because something can be computed doesn’t mean it should be computer!”

Landscape metrics

Let’s start off looking at the whole landscape with landscape metrics. This is a bit confusing because the package is called landscapemetrics. Recall that landscape metrics here are metrics that consider the entire landscape and not just a specific class or patch of class.

We will focus on four landscape metrics described above: Aggregation index (lsm_l_ai), Contagion (lsm_l_contag), Edge density (lsm_l_ed), and Patch richness (lsm_l_pr) these can be calculated using the parenthetical functions in landscapemetrics.

Code
# LANDSCAPE METRICS

# Let's calculate these for our stack of simulated rasters
# We can do this by calling up the landscape metric function and apply it 
# right to the stack
landscapemetrics::lsm_l_ai(sim_Stack)
# A tibble: 5 × 6
  layer level     class    id metric value
  <int> <chr>     <int> <int> <chr>  <dbl>
1     1 landscape    NA    NA ai      66.4
2     2 landscape    NA    NA ai      84.9
3     3 landscape    NA    NA ai      93.7
4     4 landscape    NA    NA ai      98.7
5     5 landscape    NA    NA ai      99.8
Code
landscapemetrics::lsm_l_contag(sim_Stack)
# A tibble: 5 × 6
  layer level     class    id metric value
  <int> <chr>     <int> <int> <chr>  <dbl>
1     1 landscape    NA    NA contag  13.3
2     2 landscape    NA    NA contag  26.4
3     3 landscape    NA    NA contag  39.4
4     4 landscape    NA    NA contag  50.9
5     5 landscape    NA    NA contag  54.6
Code
landscapemetrics::lsm_l_ed(sim_Stack)
# A tibble: 5 × 6
  layer level     class    id metric  value
  <int> <chr>     <int> <int> <chr>   <dbl>
1     1 landscape    NA    NA ed     6711. 
2     2 landscape    NA    NA ed     3026. 
3     3 landscape    NA    NA ed     1256. 
4     4 landscape    NA    NA ed      270. 
5     5 landscape    NA    NA ed       52.7
Code
landscapemetrics::lsm_l_pr(sim_Stack)
# A tibble: 5 × 6
  layer level     class    id metric value
  <int> <chr>     <int> <int> <chr>  <dbl>
1     1 landscape    NA    NA pr         2
2     2 landscape    NA    NA pr         2
3     3 landscape    NA    NA pr         2
4     4 landscape    NA    NA pr         2
5     5 landscape    NA    NA pr         2

Take a look at the output and compare the values (variable on the far right) for each simulated landscape (rows in the table). Notice that “class” and “id” have NA values. This is because these functions are focused on the entire landscape and not any particular class. These fields will be populated when we calculate class and patch metrics.

That was pretty easy, but we can efficiently calculate many metrics at once using calculate_lsm. We will list the functions we are interested in and name the list ls_metrics. Then use calculate_lsm on our stack of simulated landscapes (sim_Stack) and tell the function what we want to run, which in this case are the metrics we’ve listed in ls_metrics.

Code
# landsacpemetrics allows you to calculate several of these at once.
# first we need to create a list of which functions we want to use
ls_metrics <- c("lsm_l_ai", "lsm_l_contag", "lsm_l_ed", "lsm_l_pr")

# then use "calculate_lsm" and apply it to our stack, using "what" to call the list we made
landscape_metrics <- calculate_lsm(sim_Stack, what = ls_metrics)

# Look at the table you just created
View(landscape_metrics)

After we run that View() the output. You could use this output right in your paper or further analysis, but let’s use plots to be able to compare values more easily. We will put the different landscapes along the x-axis for easier comparisons and plot the metric on the y-axis. Because the different metrics are listed in our output, we can easily facet by these to compare multiple metrics in one multi-panel figure.

Code
# Let's plot the results
# This will show 4 bar graphs for 4 landscape metrics (aggregation index, contagion, edge density, and the proportion of the landscape) of 5 simulated landscapes. 
landscape_metrics %>%
  ggplot(aes(x = factor(layer), y = value)) +
  geom_col(show.legend = FALSE) +
  facet_wrap(~metric, scales = "free_y") +
  xlab("Simulated landscape") +
  ylab("Metric value") +
  theme_bw()

That’s pretty nice. Look over the results. Do they reveal the patterns you might expect after looking at the maps of the simulated landscapes? I don’t like how the metrics are labeled. Let’s not force our readers to decode our figures. We can make some labels and add it to the plots.

Code
# We can improve the labels. Let's first create a code and name lookup table
# This will show 4 bar graphs for 4 landscape metrics (aggregation index, contagion, edge density, and the proportion of the landscape) of 5 simulated landscapes. 

ls_metric_names <- c(
  ai     = "Aggregation Index",
  contag = "Contagion",
  ed     = "Edge Density",
  pr     = "Patch Richness")

# Now, include that in your labels so that readers don't have to decode anything
# We'll also make more meaningful labels of the different simulated landscapes 
# in the scale_x_discrete labels
landscape_metrics %>%
  filter(level == "landscape") %>%
  ggplot(aes(x = factor(layer), y = value)) +
  geom_col(show.legend = FALSE) +
  facet_wrap(~metric, scales = "free_y",
             labeller = labeller(metric = ls_metric_names)) +
  scale_x_discrete(labels = c("1" = "Lots of small", 
                              "2" = "",
                              "3" = "Mixed",
                              "4" = "",
                              "5" = "Very few large")) +
  xlab("Simulated landscape") + ylab("Metric value") +
  theme_bw() 

Class metrics

Now, let’s focus on the metrics associated with one class. In this case, because we’re treating the green pixels from the maps as forest, we want to calculate metrics ONLY for forest. We will focus on the percent of the landscape that is forest (lsm_c_pland), edge density of forest (lsm_c_ed), patch density (lsm_c_pd), and number of patches (lsm_c_np). As before, let’s list out which metrics we want to calculate and do this all at once. We’ll go ahead and list the codes and names in an object called class_metric_names for plotting and as reference.

Code
## CLASS METRICS

# We'll go ahead and make our label lookup table
class_metric_names <- c(
  pland  = "Percent of landscape",
  ed     = "Edge Density",
  pd     = "Patch density", 
  np     = "Number of patches")

# Which class (cl) metrics do you want to calculate? 
# We will go ahead and list these
cl_metrics <- c("lsm_c_pland", "lsm_c_ed", "lsm_c_pd", "lsm_c_np")

# and tell R to calculate these
class_metrics <- calculate_lsm(sim_Stack, what = cl_metrics)

Go ahead and View() the output we made (class_metrics), but let’s plot it as before. We’re going to label the x-axis so that we know what 1 through 5 mean. I’m going to call 1 the landscape with “Lots of small” patches and 5 the one with “Very few large” patches for our plots. We’re still just focused on forest class, so we want to filter to get only the rows where class == 2. These are the green pixels in our maps.

Code
# This will show 4 bar graphs for 4 landscape metrics (edge density, number of patches, patch density, and and the proportion of the landscape) of 5 simulated landscapes. 

class_metrics %>% dplyr::filter(class == 2) %>% 
  ggplot(aes(x = factor(layer), y = value)) +
  geom_col(position = "dodge") +
  facet_wrap(~metric, scales = "free_y", 
             labeller = labeller(metric = class_metric_names)) +
  xlab("Simulated landscape") +
  scale_x_discrete(labels = c("1" = "Lots of small", 
                              "2" = "",
                              "3" = "Mixed",
                              "4" = "",
                              "5" = "Very few large")) +
  ylab("Metric value") +
  theme_bw()

Patch metrics

Finally, let’s treat every patch of forest as its own object of interest. We’ll look at how the patch size distributions vary among the simulated landscapes. We’ve already named them by the number of patches above, but this will allow us to quantify what we can see in the maps.

To do this, we’re only going to look at patch area, which treats adjacent pixels of the same class as a patch and calculates their area. We’ll use this to investigate patch size distributions. In other words, how many patches occur in different size classes? Note: defining a “patch” in gridded data requires that you be mindful of whether corner-adjacent pixels with the same class belong in the same patch or not. This is often referred to in the literature as “Rook’s case” (i.e., only consider 4 pixels sharing a border) or “Queen’s case” (i.e., consider all 8 pixels sharing a border or a corner). The default in landscapemetrics is Queen’s case, but be aware that results can be sensitive to these decisions. See image below where a binary landscape (forest or not) will have different number of patches depending on whether you use a Rook’s case (directions = 4) or a Queen’s case (directions = 8).

Three raster grids illustrating how the definition of cell adjacency affects patch delineation. Left panel shows the original landscape with green forest cells on a gray background. Center panel shows Rook’s case adjacency where only cells sharing a full edge are considered connected, resulting in 11 separate patches each shown in a different color. Right panel shows Queen’s case adjacency where cells sharing either an edge or a corner are considered connected, resulting in fewer patches (6) shown in different colors because diagonal connections merge previously separate patches. Figure by Travis Belote

Run the patch metrics and plot the patch size distributions for “forests” (class == 2) for each landscape. We’ll also improve the labels of the plots.

Code
# run the area patch metrics
# note: you can change from Queen's case to Rook's case by adding directions = 4
# like this pa <- lsm_p_area(sim_Stack, directions = 4)
pa <- lsm_p_area(sim_Stack)

# This will show 5 histograms of patch size distribution for 5 simulated landscapes. 
pa %>% dplyr::filter(class == 2) %>% ggplot(aes(value)) +
  geom_histogram(bins = 15, fill = "darkgreen") +
  scale_x_log10() +
  facet_wrap(~layer, scales = "free_x") + 
  xlab("Patch size") + ylab("Number") +
  theme_bw()

Code
# Let's add labels to the facets so there's no guessing!
# Make the labels
landscape_labels <- c("1" = "Lots of small",
                      "2" = "Mostly small",
                      "3" = "Mixed",
                      "4" = "Few large",
                      "5" = "Very few large")

# Add the labels
# This will show 5 histograms of patch size distribution for 5 simulated landscapes. 
pa %>% dplyr::filter(class == 2) %>% ggplot(aes(value)) +
  geom_histogram(bins = 15, fill = "darkgreen") +
  scale_x_log10() +
  facet_wrap(~layer, scales = "free_x", labeller = labeller(layer = landscape_labels)) + 
  xlab("Patch size") + ylab("Number") +
  theme_bw()

TASK 1.

Copy and paste the maps and patch size distribution into one document. If the green represents natural areas, which map do you think would sustain more biodiversity? Remember that all five maps maintain the same amount of natural areas (30%). Along with your figures, write up a short paragraph describing your prediction and rationale.

OR

Re-run the code above but use Rook’s case (4-cell rule) to evaluate patch size distributions. How do the metrics change? Describe why this is and what the consequences could be with a real example if we were estimating habitat patch sizes of a species and making management decisions based on this assessment.

OR

Re-run the code above, but choose other metrics that might be interesting given your specific research questions. Interpret and explain the results and their possible causes and consequences for some ecological process (e.g., fire or animal movement) or phenomena (e.g., habitat use by species or physiological stress).

Real Montana landscapes.

Let’s redo this analysis, but using real landscapes in Montana.

We will bring in the National Land Cover Database (NLCD) for 4 different places in Montana, visualize the data making sure to use the NLCD names and colors, calculate metrics of landscapes, classes, and patches, and compare these metrics among the landscapes.

First, bring in the boundaries of the landscapes and look at the aerial imagery under each. Don’t forget to use Google Earth or other aerial imagery as you interpret your data, develop hypotheses, and think about nature at landscape scales. Aerial imagery inspired Carl Troll to first coin the term “landscape ecology”, so don’t be shy about looking at photos of the Earth from space!

Code
# Bring in 4 landscapes in Montana and look at them.
# This will return an interactive map showing the location of four landscapes studied in this lab.
real_landscapes <- vect("data/Lab6/nlcd_samples.shp")

if (knitr::is_html_output()) {
  mapviewOptions(basemaps = "Esri.WorldImagery")
  mapview(real_landscapes, col.regions = NA, alpha.regions = 0, color = "white", lwd = 2)
} else {
  # Static fallback: no satellite basemap available in PDF, so just show
  # the boundaries themselves with a dark outline for visibility on white.
  plot(real_landscapes, border = "black", lwd = 2, col = NA)
}

You can click on the squares to view which landscape is which. What do you notice about the natural patterns of these different landscapes? How much forest, shrub or grasslands, developed areas are there?

Now, let’s bring in the NLCD data, use a nice function to color-code the pixels per NLCD’s convention, and look at the landscapes.

Code
# Bring in the land cover data for these landscapes 
treasurNLCD2 <- rast("data/Lab6/treasurNLCD.tif")
bobmarsNLCD2 <- rast("data/Lab6/bobmarsNLCD.tif")
bozemanNLCD2 <- rast("data/Lab6/bozemanNLCD.tif")
kootenaNLCD2 <- rast("data/Lab6/kootenaNLCD.tif")

# These steps assign the values in the raster to the codes and colors in the NLCD data
levels(treasurNLCD2) <- FedData::nlcd_colors()[,1:3]
coltab(treasurNLCD2) <- with(FedData::nlcd_colors(), data.frame(value = ID, R = col2rgb(Color)[1,], G = col2rgb(Color)[2,], B = col2rgb(Color)[3,]))

levels(bobmarsNLCD2) <- FedData::nlcd_colors()[,1:3]
coltab(bobmarsNLCD2) <- with(FedData::nlcd_colors(), data.frame(value = ID, R = col2rgb(Color)[1,], G = col2rgb(Color)[2,], B = col2rgb(Color)[3,]))

levels(bozemanNLCD2) <- FedData::nlcd_colors()[,1:3]
coltab(bozemanNLCD2) <- with(FedData::nlcd_colors(), data.frame(value = ID, R = col2rgb(Color)[1,], G = col2rgb(Color)[2,], B = col2rgb(Color)[3,]))

levels(kootenaNLCD2) <- FedData::nlcd_colors()[,1:3]
coltab(kootenaNLCD2) <- with(FedData::nlcd_colors(), data.frame(value = ID, R = col2rgb(Color)[1,], G = col2rgb(Color)[2,], B = col2rgb(Color)[3,]))


# Look at the differences in landscape patterns. 
# Before you work on quantifying landscape metrics, it is a good idea to 
# view the patterns and consider the sizes of patches, their distributions,
# arrangements, etc. What do you notice in these locations?
# This will show land cover data for the four Montana landscapes.
par(mfrow = c(2, 2))
plot(treasurNLCD2, legend = F, main = "Treasure")
plot(bozemanNLCD2, legend = F, main = "Bozeman")
plot(kootenaNLCD2, legend = F, main = "Kootenai")
plot(bobmarsNLCD2, legend = F, main = "Bob Marshall")

Code
# dev.off()

Now, let’s calculate the landscape, class, and patch metrics.

Landscape metrics

Code
# Let's use the same metrics as above
ls_metrics <- c("lsm_l_ai", "lsm_l_contag", "lsm_l_ed", "lsm_l_pr")
cl_metrics <- c("lsm_c_pland", "lsm_c_ed", "lsm_c_pd", "lsm_c_np")
pa_metrics <- lsm_p_area

# We could create a list and do this in a loop, but let's do this one at a time.
treasur_ls <- calculate_lsm(treasurNLCD2, what = ls_metrics)
bozeman_ls <- calculate_lsm(bozemanNLCD2, what = ls_metrics)
kootena_ls <- calculate_lsm(kootenaNLCD2, what = ls_metrics)
bobmars_ls <- calculate_lsm(bobmarsNLCD2, what = ls_metrics)

Look at any of the outputs we made from above. Notice there’s no variable that allows us to differentiate between the real landscapes let’s add the names to each of the output tables from above # by creating a new variable with $landscape and assign the correct name to that variable.

Code
treasur_ls$landscape <- "Treasure"
bozeman_ls$landscape <- "Bozeman"
kootena_ls$landscape <- "Kootenai"
bobmars_ls$landscape <- "Bob_Marshall"

# Now look at any of these
treasur_ls
# A tibble: 4 × 7
  layer level     class    id metric value landscape
  <int> <chr>     <int> <int> <chr>  <dbl> <chr>    
1     1 landscape    NA    NA ai      79.9 Treasure 
2     1 landscape    NA    NA contag  60.2 Treasure 
3     1 landscape    NA    NA ed     134.  Treasure 
4     1 landscape    NA    NA pr      15   Treasure 

Let’s combine these four landscapes into one dataframe using rbind (row bind).

Code
lsm_real <- rbind(treasur_ls, bozeman_ls, kootena_ls, bobmars_ls)

And, let’s plot the patterns, going through a few options.

Code
# and plot the data
# This will show 4 bar graphs for 4 landscape metrics (aggregation index, contagion, edge density, and patch richness) of 4 Montana landscapes. 

lsm_real %>% ggplot(aes(x = landscape, y = value)) + 
  geom_col() + 
  facet_wrap(~metric, scales = "free_y") + 
  ylab("") +
  theme_bw()

Code
# Let's flip the x and y to see how that looks
# This will show 4 bar graphs for 4 landscape metrics (aggregation index, contagion, edge density, and patch richness) of 4 Montana landscapes. Now, the bar graphs are rotated.
lsm_real %>% ggplot(aes(x = value, y = landscape)) + 
  geom_col() + 
  facet_wrap(~metric, scales = "free_x") + 
  ylab("") +
  theme_bw()

Code
# remember we made this label look-up table. Let's use it. 
ls_metric_names <- c(
  ai     = "Aggregation Index",
  contag = "Contagion",
  ed     = "Edge Density",
  pr     = "Patch Richness")

# we'll add it to the plot and make the grey a little lighter
# This will show 4 bar graphs for 4 landscape metrics (aggregation index, contagion, edge density, and patch richness) of 4 Montana landscapes. Now, the bar graphs are rotated.

lsm_real %>% ggplot(aes(x = value, y = landscape)) + 
  geom_col(fill = "grey80") + 
  facet_wrap(~metric, scales = "free_x",   
             labeller = labeller(metric = ls_metric_names)) +  
  ylab("") + xlab("Value") +
  theme_bw()

What do you notice about these metrics and how they vary among these real landscapes? Do the patterns agree with your expectations?

Class metrics

Now, let’s calculate some class metrics.

Code
###### Class metrics
# Let's use the same metrics as above
cl_metrics <- c("lsm_c_pland", "lsm_c_ed", "lsm_c_pd", "lsm_c_np")

# We could create a list and do this in a loop, but let's do this one at a time.
treasur_cl <- calculate_lsm(treasurNLCD2, what = cl_metrics)
bozeman_cl <- calculate_lsm(bozemanNLCD2, what = cl_metrics)
kootena_cl <- calculate_lsm(kootenaNLCD2, what = cl_metrics)
bobmars_cl <- calculate_lsm(bobmarsNLCD2, what = cl_metrics)

treasur_cl$landscape <- "Treasure"
bozeman_cl$landscape <- "Bozeman"
kootena_cl$landscape <- "Kootenai"
bobmars_cl$landscape <- "Bob_Marshall"

class_lsm_real <- rbind(treasur_cl, bozeman_cl, kootena_cl, bobmars_cl)
View(class_lsm_real)

Now that we’re looking at “class” metrics, let’s choose a land cover class to investigate. Here will will focus on evergreen forest. We can use nlcd_color() to look up the codes.

Code
# Take a look at what this returns.
nlcd_colors()
# A tibble: 20 × 4
      ID Class                        Color   Description                       
   <dbl> <chr>                        <chr>   <chr>                             
 1    11 Open Water                   #5475A8 Areas of open water, generally wi…
 2    12 Perennial Ice/Snow           #FFFFFF Areas characterized by a perennia…
 3    21 Developed, Open Space        #E8D1D1 Areas with a mixture of some cons…
 4    22 Developed, Low Intensity     #E29E8C Areas with a mixture of construct…
 5    23 Developed, Medium Intensity  #ff0000 Areas with a mixture of construct…
 6    24 Developed High Intensity     #B50000 Highly developed areas where peop…
 7    31 Barren Land (Rock/Sand/Clay) #D2CDC0 Areas of bedrock, desert pavement…
 8    41 Deciduous Forest             #85C77E Areas dominated by trees generall…
 9    42 Evergreen Forest             #38814E Areas dominated by trees generall…
10    43 Mixed Forest                 #D4E7B0 Areas dominated by trees generall…
11    51 Dwarf Scrub                  #AF963C Alaska only areas dominated by sh…
12    52 Shrub/Scrub                  #DCCA8F Areas dominated by shrubs; less t…
13    71 Grassland/Herbaceous         #FDE9AA Areas dominated by gramanoid or h…
14    72 Sedge/Herbaceous             #D1D182 Alaska only areas dominated by se…
15    73 Lichens                      #A3CC51 Alaska only areas dominated by fr…
16    74 Moss                         #82BA9E Alaska only areas dominated by mo…
17    81 Pasture/Hay                  #FBF65D Areas of grasses, legumes, or gra…
18    82 Cultivated Crops             #CA9146 Areas used for the production of …
19    90 Woody Wetlands               #C8E6F8 Areas where forest or shrubland v…
20    95 Emergent Herbaceous Wetlands #64B3D5 Areas where perennial herbaceous …

Evergreen forests have ID code of 42, so let’s first filter the data and only plot the results for this class.

Code
# Notice that I'll adjust the x-label to indicate our focus land cover
# I'll also borrow from the label look up table from above

# This will show 4 bar graphs for 4 landscape metrics (edge density, number of patches, patch density, and and the proportion of the landscape) of 4 Montana landscapes. Now, the bar graphs are rotated.
class_lsm_real %>% dplyr::filter(class == 42) %>% 
  ggplot(aes(x = value, y = landscape)) + 
  geom_col(fill = "grey80") + 
  facet_wrap(~metric, scales = "free_x",   
             labeller = labeller(metric = class_metric_names)) +  
  ylab("") + xlab("Value for evergreen forests") +
  theme_bw()

Again, look at these results in light of the aerial imagery and the patterns you observe in the NLCD maps. Do the patterns align with your expectations?

Patch metrics

Finally, let’s look at patch metrics (patch size distributions) for Evergreen forests using the same steps but different functions as above.

Code
###### Patch metrics
# Since we're only going to be looking at patch size distributions we'll just use this
# function

treasur_pa <- lsm_p_area(treasurNLCD2)
bozeman_pa <- lsm_p_area(bozemanNLCD2)
kootena_pa <- lsm_p_area(kootenaNLCD2)
bobmars_pa <- lsm_p_area(bobmarsNLCD2)

treasur_pa$landscape <- "Treasure"
bozeman_pa$landscape <- "Bozeman"
kootena_pa$landscape <- "Kootenai"
bobmars_pa$landscape <- "Bob_Marshall"

# use rbind to combine the output tables
patch_lsm_real <- rbind(treasur_pa, bozeman_pa, kootena_pa, bobmars_pa)
# look at it the data, notice "id"
View(patch_lsm_real)

# let's look at how the patch size distributions of evergreen forests vary among our landscapes
# This will return histograms showing patch size distributions of evergreen forests in each of the four Montana landscapes.
patch_lsm_real %>% dplyr::filter(class == 42) %>% ggplot(aes(value)) +
  geom_histogram(bins = 15, fill = "darkgreen") +
  scale_x_log10() +
  facet_wrap(~landscape) + 
  xlab("Patch size (hectares)") + ylab("Number") +
  theme_bw()

One other very important decision we need to be aware of is the “taxonomic resolution” of our data. For this lab, we are using the NLCD data, which uses 16 different land cover classes. There are other land cover datasets that have a much higher taxonomic resolution and recognize and map hundreds of different ecosystem classes. And, of course, you can reduce the number of land cover classes by lumping categories (i.e., combine deciduous, evergreen, and mixed forest class into one class of “forest”). The below image shows the land cover data and classification from the Gap Analysis Project (GAP) on the left that recognizes over 800 different land cover classes compared to the 16 different NLCD classes (right).

Two side-by-side land cover maps of the Bozeman, Montana area illustrating the effect of taxonomic resolution on landscape classification. The left panel shows higher taxonomic resolution with many fine-grained vegetation classes distinguished by numerous colors, revealing detailed distinctions between forest types, shrubland subtypes, and agricultural land uses. The right panel shows lower taxonomic resolution where the same landscape is classified into fewer broader categories, with forest consolidated into a single dark green class and other cover types generalized, resulting in a simpler but less detailed representation. Figure by Travis Belote.

TASK 2.

We looked at evergreen forests for our “class” and “patch” metrics. Choose a different land cover type and explore the class metrics and patch size distributions. Look at the maps. Look at the metrics. Think about why these metrics matter to ecological processes (what processes give rise to these patterns and what processes might these patterns influence?). Compare your results among landscapes. Compare your results to the patterns we observed in evergreen forests. Write up your results as an abstract for Landscape Ecology.

OR

Go to the folder (“data/Lab6/lumped_nlcd”) that includes datasets where I have lumped land cover classes into broader categories and explore how taxonomic resolution changes our assessment of these landscape, class, and patch metrics. I created new land cover datasets with coarser taxonomic resolutions by lumping deciduous forests (NLCD code 41), evergreen forests (NLCD code 42) and mixed forests (NLCD code 43) into one “forest” class. I also lumped all developed classes and natural classes together to make a “natural or not” land cover map. Run through the code for Montana landscapes above using these lumped datasets and compare your results and describe the effects of taxonomic resolution. In what cases would you want to focus on landscape patterns using a finer resolution? In what cases might you want to use a map of coarser (“lumped”) classes?

OR

Choose your own adventure, but make sure to calculate at least two landscape metrics and describe a possible cause AND consequence of the patterns.

Data source(s)

Annual National Land Cover Database, which can be downloaded here.