Download Lab7.zip from the course data archive on Zenodo and unzip it into a folder called data/Lab7/ in your project directory.
Background
Human modification and conversion of land are among the most pervasive drivers of global ecological change. As natural ecosystems are converted to agriculture, developed land, or other human uses, the structure and function of landscapes are transformed, leading to declines in native biodiversity, disruption of ecological processes, and loss of ecosystem services. These changes fragment once-contiguous habitats, alter fire regimes and hydrology, and often reduce the capacity of landscapes to support species movement and adaptation under a changing climate.
In previous labs, we have used land cover data to assess the composition and configuration of landscapes (for example, quantifying proportions of forest, grassland, and developed land). In this lab, we will extend those analyses to examine change through time, using both observed and projected data.
We will use data from the National Land Cover Database (NLCD) to measure changes in land cover between 1989 and 2024 (focusing on Montana, Idaho, and Wyoming). The NLCD provides a consistent, 30-meter resolution dataset of land cover types across the contiguous United States. It allows us to evaluate how much and in what ways landscapes have changed (for instance, forest to shrubland following wildfire, or conversion of grasslands to development or agriculture).
Two side-by-side National Land Cover Database maps of the contiguous United States comparing land cover in 1989 (left) and 2024 (right). Both maps show the same color scheme with forests in green, shrublands and grasslands in tan and brown, agricultural lands in yellow-green, and water bodies in blue. Comparing the two time periods reveals land cover changes across the country including shifts in forest cover, agricultural extent, and developed areas.
Land cover change in Wilderness
The National Wilderness Preservation System contains over 800 wilderness areas established through the U.S. Congress to preserve the natural and untrammeled character of 111 million acres. When signing the Wilderness Act in 1964, President Johnson said: “The wilderness bill preserves for our posterity, for all time to come, 9 million acres of this vast continent in their original and unchanging beauty and wonder.”
We will be looking at whether wilderness areas have changed between 1989 and 2024 (the 25th and 60th anniversaries of the Wilderness Act, respectively). We start off by investigating how land cover may have changed in the Bob Marshall Wilderness between 1989 and 2024. The “Bob” is Montana’s largest wilderness area and named after forester and founder of The Wilderness Society. Fire has shaped the landscape in recent years.
Photo courtesy of Evan Hjerpe.
We will start off by loading packages (install any that you need to) and bringing in the NLCD data that I have extracted for Montana, Idaho, and Wyoming. After bringing in the data, I remove some of information and built-in colors, which create issues in R. These steps are not necessary, but they clean up the data and allow us to more cleanly use the standard NLCD colors. Full disclosure: ChatGPT helped me figure this part out. After we get that set up, plot the land cover data for both years.
Code
# Load packages (install if you need to)library(terra)library(FedData)library(tidyverse)library(tigris)library(sf)library(mapview)library(RColorBrewer)library(landscapemetrics)library(ggiraph)# Bring data in for 1989 and 2024nlcd1989_MTIDWY <-rast("data/Lab7/NLCD_1989_MTIDWY.tif")nlcd2024_MTIDWY <-rast("data/Lab7/NLCD_2024_MTIDWY.tif")# These next steps are tweaking the data levels(nlcd1989_MTIDWY) <-NULLlevels(nlcd2024_MTIDWY) <-NULL# drop color tables from both layerscoltab(nlcd1989_MTIDWY) <-NULLcoltab(nlcd2024_MTIDWY) <-NULL# create a new table called "nlcd_classes" based on the nlcd_colors()nlcd_classes <- FedData::nlcd_colors() %>% dplyr::select(ID, Class)# assign the levels of the NLCD data using the classes we just madelevels(nlcd1989_MTIDWY) <- nlcd_classeslevels(nlcd2024_MTIDWY) <- nlcd_classes# assign the coltab (color table) using the nlcd_color() functioncoltab(nlcd1989_MTIDWY) <-with(FedData::nlcd_colors(), data.frame(value = ID, R =col2rgb(Color)[1,],G =col2rgb(Color)[2,],B =col2rgb(Color)[3,]))coltab(nlcd2024_MTIDWY) <-with(FedData::nlcd_colors(), data.frame(value = ID, R =col2rgb(Color)[1,],G =col2rgb(Color)[2,],B =col2rgb(Color)[3,]))# Look at the maps# This will show land cover data for Montana, Idaho, and Wyoming for 1989 and 2024.par(mfrow =c(1, 2))plot(nlcd1989_MTIDWY)plot(nlcd2024_MTIDWY)
Code
dev.off()
null device
1
Bring in the wilderness data for Montana, Idaho, and Wyoming, project it so that the crs matches the NLCD data, and plot over top of land cover data. In previous labs, we have used vect() to import polygon data as shapefiles. This could work here too, but instead we will use st_read() using the sf package function. It is easier to use dplyr function with sf objects.
Code
# Bring in the shapefile of wilderness areas in Montana, Idaho, and Wyoming.nwps <- sf::st_read("data/Lab7/nwps_MTIDWY.shp")
Reading layer `nwps_MTIDWY' from data source
`Z:\Teaching\BIOE515_LandEcol_Man_Fall2025\Book\Final_v1.0\data\Lab7\nwps_MTIDWY.shp'
using driver `ESRI Shapefile'
Simple feature collection with 49 features and 20 fields
Geometry type: MULTIPOLYGON
Dimension: XY
Bounding box: xmin: -13028120 ymin: 5012231 xmax: -11613380 ymax: 6274727
Projected CRS: WGS 84 / Pseudo-Mercator
Code
# Do the coordinate reference systems match the NLCD data?crs(nwps) ==crs(nlcd1989_MTIDWY)
[1] FALSE
Code
# transform (project) the NWPS data so that it matches the crs of the NLCDnwpsPRJ <-st_transform(nwps, crs(nlcd1989_MTIDWY))# Plot the 1989 NLCD and then the wilderness areas on top of it.# This will show land cover data for Montana, Idaho, and Wyoming for 1989 with wilderness areas plotted onto the map.plot(nlcd1989_MTIDWY)plot(nwpsPRJ, add = T, col =NA)
Now, we need to choose a wilderness area for our investigation. Remember, we’re interested in how land cover has changed between 1989 and 2024. We will start off investigating patterns in the Bob Marshall Wilderness, which has experience a lot of fire in the last 30 years.
Code
# Select a Wilderness Area using dplyr's filter, which is nice.bob <- nwpsPRJ %>% dplyr::filter(NAME =="Bob Marshall Wilderness")# Extract the land cover data for both years to the Bob boundary.bob_nlcd_2024 <- nlcd2024_MTIDWY %>%crop(bob) %>%mask(bob)bob_nlcd_1989 <- nlcd1989_MTIDWY %>%crop(bob) %>%mask(bob)# Plot the land cover data for the Bob.# This will show land cover data for the Bob Marshall Wilderness for 1989 and 2024.par(mfrow =c(1, 2))plot(bob_nlcd_1989, axes = F)plot(bob_nlcd_2024, axes = F)
Code
dev.off()
null device
1
Look at the maps of land cover for 1989 and 2024. What do you notice? Has the composition and patterns of land cover changed? Why?
Let’s quantify this. We’ll start just using freq() to calculate a frequency table of land cover types. Recall this is how we investigated the composition of land cover types in an earlier lab.
Code
# Look at the frequency (number of pixels) in different land cover classes.freq(bob_nlcd_1989)
layer value count
1 1 Open Water 11395
2 1 Perennial Ice/Snow 7057
3 1 Developed, Open Space 1325
4 1 Developed, Low Intensity 5724
5 1 Developed, Medium Intensity 981
6 1 Developed High Intensity 11
7 1 Barren Land (Rock/Sand/Clay) 178286
8 1 Deciduous Forest 204
9 1 Evergreen Forest 3619813
10 1 Mixed Forest 292
11 1 Shrub/Scrub 696598
12 1 Grassland/Herbaceous 259140
13 1 Pasture/Hay 4
14 1 Woody Wetlands 12257
15 1 Emergent Herbaceous Wetlands 1327
Code
freq(bob_nlcd_2024)
layer value count
1 1 Open Water 9905
2 1 Perennial Ice/Snow 7057
3 1 Developed, Open Space 1995
4 1 Developed, Low Intensity 6501
5 1 Developed, Medium Intensity 516
6 1 Developed High Intensity 2
7 1 Barren Land (Rock/Sand/Clay) 184037
8 1 Deciduous Forest 232
9 1 Evergreen Forest 2472728
10 1 Mixed Forest 426
11 1 Shrub/Scrub 1638727
12 1 Grassland/Herbaceous 457682
13 1 Pasture/Hay 11
14 1 Cultivated Crops 3
15 1 Woody Wetlands 13013
16 1 Emergent Herbaceous Wetlands 1579
Let’s stack these two year’s of data up to make it easier to work with. It is always nice to “take control” of the names in raster stacks, so let’s rename the stacks “lc1989” and “lc2024”.
Code
# Stack the two years of data and rename the layersbob_nlcd <-c(bob_nlcd_1989, bob_nlcd_2024)names(bob_nlcd) <-c("lc1989", "lc2024")
Rather than using freq(), let’s use landscapemetrics function lsm_c_pland. Recall that this calculates the proportion of the landscape in specific classes.
Code
# Run landscapemetrics' "pland" (% of landscape) metriclandscapemetrics::lsm_c_pland(bob_nlcd)
# A tibble: 31 × 6
layer level class id metric value
<int> <chr> <int> <int> <chr> <dbl>
1 1 class 11 NA pland 0.238
2 1 class 12 NA pland 0.147
3 1 class 21 NA pland 0.0276
4 1 class 22 NA pland 0.119
5 1 class 23 NA pland 0.0205
6 1 class 24 NA pland 0.000229
7 1 class 31 NA pland 3.72
8 1 class 41 NA pland 0.00425
9 1 class 42 NA pland 75.5
10 1 class 43 NA pland 0.00609
# ℹ 21 more rows
What has changed and by how much? What do you think about President’s Johnson’s comments about protecting wilderness that is unchanging?
TASK 1.
Calculate other landscape, class, or patch metrics for the Bob Marshall Wilderness and discuss the causes and possible consequences of these changes for ecological processes. Do these changes challenge the notion of wilderness as unchanging? Does this matter to management of wilderness or the establishment of new wilderness areas? Write up your results as an abstract for Landscape Ecology.
OR
Run ls_c_pland and the other landscape metric for another wilderness area, discuss the causes and possible consequences. As above, consider your results in the context of wilderness policy. Write up your results as an abstract for Landscape Ecology.
Projected land cover in U.S. ecoregions
In addition to observed historical change, we will explore forecasted land cover scenarios developed by Terry Sohl and colleagues at the USGS EROS Center. These models simulate potential future land cover to 2100 under alternative socioeconomic and policy scenarios (e.g., A1B – high economic growth and globalization, and B2 – lower growth emphasizing regional sustainability). The projections use suitability maps and patch-growing algorithms to represent spatially explicit land use and land cover change. These algorithms also include empirical transition probabilities (based on observed historical change) and scenario-specific assumptions about population growth, policy, and land use. I have selected data for 2010, 2020, 2030, 2040, 2050, 2060, 2070, 2080, 2090, and 2100 to investigate changes in decade time steps.
Figure by Travis Belote using FORE-SCE data from Sohl et al. 2014, Ecological Applications 24(5):1015–1036. https://doi.org/10.1890/13-1245.1
These projections allow us to visualize and quantify how different policies or economic futures could shape U.S. landscapes. For example, where do forests expand or contract, or how agricultural and urban land use spread given “story lines” of population growth and demand for different goods? We will focus on selected Level IV ecoregions to explore these modeled futures and quantify changes in land cover composition using landscape metrics. We will pay particular attention to how the different scenarios affect the results.
We will start off using list.files telling R to find files with the .tif file extension using pattern = ".tif$". We also want the full names of the files so we can easily bring them in and stack them, so we will using full.names = TRUE.
Code
# Future predictions of land cover change# Data were downloaded from here: # https://www.sciencebase.gov/catalog/item/5b96c2f9e4b0702d0e826f6d# list the files with .tif patterns and return the full namesfuture_lc_files <-list.files("data/Lab7/Sohl", pattern =".tif$", full.names =TRUE)# stack those files upfuture_lc <-rast(future_lc_files)# Go ahead and look at the files. How many layers are here? What do they represent?# This will show 16 maps of land cover predictions for the contiguous U.S. from 2010 to 2100 under two different scenarios (A1B and B2)plot(future_lc)
Code
# and look at any properties, if you're interested# Check the resolutionres(future_lc)
[1] 250 250
We want to investigate how land use and cover may change in specific ecoregions of the contiguous United States. We’ll bring in Level IV ecoregions, look at the map of ecoregions, project them so that the CRS matches the land cover data, and use mapview to look around.
Code
# Bring in the ecoregions using sf::st_read()ecoreg <-st_read("data/Lab7/us_eco_l3_MTIDWY.shp")
Reading layer `us_eco_l3_MTIDWY' from data source
`Z:\Teaching\BIOE515_LandEcol_Man_Fall2025\Book\Final_v1.0\data\Lab7\us_eco_l3_MTIDWY.shp'
using driver `ESRI Shapefile'
Simple feature collection with 819 features and 1 field
Geometry type: MULTIPOLYGON
Dimension: XY
Bounding box: xmin: -1715671 ymin: 2027604 xmax: -595594.4 ymax: 3059862
Projected CRS: USA_Contiguous_Albers_Equal_Area_Conic_USGS_version
Code
# Look at the map.# This is a plot of ecoregions in Montana, Idaho, and Montana.plot(st_geometry(ecoreg), col ="grey90")
Code
# Project the ecoregions so that the crs matches the land cover dataecoregPRJ <-st_transform(ecoreg, crs(future_lc))# you might look to see how many different Level IV ecoregions there are.# unique(ecoregPRJ$US_L4NAME)# Use mapview to look at the ecoregions, pan around, and # click on some to see their names.# This is a plot of ecoregions in Montana, Idaho, and Montana in an interactive map.if (knitr::is_html_output()) {mapview(ecoregPRJ, zcol ="US_L4NAME", col.regions =brewer.pal(8, "Set3"), legend =FALSE)} else {ggplot(ecoregPRJ) +geom_sf(aes(fill = US_L4NAME)) +scale_fill_brewer(palette ="Set3", guide ="none") +theme_bw() +theme(axis.text =element_blank(), axis.ticks =element_blank())}
Let’s see how Gallatin Valley might change in the next 75 years. The Gallatin Valley is part of the ecoregion called the Townsend Basin. Let’s pull that ecoregion in and use it to clip the land cover data.
Code
# "Pull" the ecoregion called "Townsend Basin"townsend_basin <- ecoregPRJ %>% dplyr::filter(US_L4NAME =="Townsend Basin")# Clip the land cover data to the Townsend Basin ecoregiontownsend_b_lcc <- future_lc %>%crop(townsend_basin) %>%mask(townsend_basin)# Look at the maps# This is a plot of 16 land cover predictions for the "Townsend Basin" ecoregion from 2010 to 2100 under two different scenarios (A1B and B2). plot(townsend_b_lcc)
Now that we have the data clipped to the Townsend Basin ecoregion, we will use landscape metrics to assess the composition through time using lsm_c_pland (percent of landscape).
Code
# calculate the percent of the landsacpe that is in different classeseco_pland <- landscapemetrics::lsm_c_pland(townsend_b_lcc)
I have created a lookup table the lumped NLCD classes that Sohl et al. used. Bring that csv in.
Code
# Bring in the table of lumped NLCD names to join with the analysis. lc_names <-read.csv("data/Lab7/FORE_SCE_17class_lookup.csv")View(lc_names)
Now, use join this table to the landscape metrics output so that we can assess how changes in land cover using the names instead of the code.
Code
# We will join the output from above to the table of land cover names.eco_pland <- eco_pland %>%left_join(lc_names, by ="class")
We also want to recode the layer names to be meaningful. Look at the names from the stack and write them out here. After that, let’s create a new variable identifying the year and another identifying the scenario. It will be useful to have “year” and “scenario” separated when we analyze the patterns. We will use str_sub from stringr in the tidyverse to do this.
eco_pland$year_scenario <-recode(eco_pland$layer,`1`="2010_A1B",`2`="2020_A1B",`3`="2030_A1B",`4`="2040_A1B",`5`="2050_A1B",`6`="2060_A1B",`7`="2070_A1B",`8`="2080_A1B",`9`="2090_A1B",`10`="2100_A1B",`11`="2010_B2",`12`="2020_B2",`13`="2030_B2",`14`="2040_B2",`15`="2050_B2",`16`="2060_B2",`17`="2070_B2",`18`="2080_B2",`19`="2090_B2",`20`="2100_B2")# Create a new variable called "year" and use the code above to get the yeareco_pland$year <-as.numeric(str_sub(eco_pland$year_scenario, 1, 4))# Create a new variable called "scenario". eco_pland$scenario <-str_sub(eco_pland$year_scenario, 6, 8)
Let’s use the hexbin colors from the lookup table to create a color lookup for plotting. This ensure that our plots of land cover classes will use the same colors as in the maps. Keeping your colors in maps and figures consistent makes reading and analysis much cleaner.
Code
colors <- eco_pland %>%distinct(Land_Cover_Class, hex) %>%pull(hex, name = Land_Cover_Class)
Let’s plot the percent of the landscape (the Townsend Basin ecoregion) through time only for the A1B scenario. We’ll start by using filter to get only A1B, then plot year on the x-axis and “value” on the y-axis. Recall that “value” in the output from ls_c_pland is the class metric “percent of the landscape”.
Code
# Plot percent of the landscape ("value") across years only for the A1B scenario.# Assign the different land cover classes the colors we made above. # This shows a line graph of % of the Townsend Basin ecoregion in 16 different land cover classes from 2010 to 2100. eco_pland %>% dplyr::filter(scenario =="A1B") %>%ggplot(aes(x = year, y = value, color = Land_Cover_Class)) +geom_line(lwd =1) +scale_color_manual(values = colors, name ="Land Cover") +ylab("% of ecoregion") +xlab("Year") +theme_bw()
Now, let’s keep the two scenarios and “facet” them so that we can compare patterns through time among the different scenarios.
Code
# Plot percent of the landscape ("value") across years for both scenarios using # facet_grid# # This shows a line graph of % of the Townsend Basin ecoregion in 16 different land cover classes from 2010 to 2100 for 2 future scenarios (A1B and B2).eco_pland %>%ggplot(aes(x = year, y = value, color = Land_Cover_Class)) +geom_line_interactive(aes(tooltip = Land_Cover_Class), linewidth =1) +scale_color_manual(values = colors, name ="Land Cover") +facet_grid(~scenario) +ylab("% of ecoregion") +xlab("Year") +theme_bw()
TASK 2.
Choose another ecoregion and re-run the analysis above. Discuss what the projections might mean for some ecological process or conservation issue. Write up your results as an abstract for Landscape Ecology.
Data source(s)
Annual National Land Cover Database, which can be downloaded here.
Projected land cover data from 1992 to 2100 can be downloaded here.
National Wilderness Preservation System (wilderness areas) can be downloaded here.
---title: "Lab 7. Land Cover Change"subtitle: "Observed and projected change in land cover"---::: {.callout-note appearance="minimal"}**Data for this lab.**Download `Lab7.zip` from the [course data archive on Zenodo](https://doi.org/10.5281/zenodo.22101926) and unzip it into a folder called `data/Lab7/` in your project directory.:::# BackgroundHuman modification and conversion of land are among the most pervasive drivers of global ecological change. As natural ecosystems are converted to agriculture, developed land, or other human uses, the structure and function of landscapes are transformed, leading to declines in native biodiversity, disruption of ecological processes, and loss of ecosystem services. These changes fragment once-contiguous habitats, alter fire regimes and hydrology, and often reduce the capacity of landscapes to support species movement and adaptation under a changing climate.In previous labs, we have used land cover data to assess the composition and configuration of landscapes (for example, quantifying proportions of forest, grassland, and developed land). In this lab, we will extend those analyses to examine change through time, using both observed and projected data.We will use data from the National Land Cover Database (NLCD) to measure changes in land cover between 1989 and 2024 (focusing on Montana, Idaho, and Wyoming). The NLCD provides a consistent, 30-meter resolution dataset of land cover types across the contiguous United States. It allows us to evaluate how much and in what ways landscapes have changed (for instance, forest to shrubland following wildfire, or conversion of grasslands to development or agriculture).# Land cover change in WildernessThe National Wilderness Preservation System contains over 800 wilderness areas established through the U.S. Congress to preserve the natural and untrammeled character of 111 million acres. When signing the Wilderness Act in 1964, President Johnson said: "The wilderness bill preserves for our posterity, for all time to come, 9 million acres of this vast continent in their original and **unchanging** beauty and wonder." *Public domain. Source: [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:Sept_04_wilderness.jpg)*We will be looking at whether wilderness areas have changed between 1989 and 2024 (the 25th and 60th anniversaries of the Wilderness Act, respectively). We start off by investigating how land cover may have changed in the Bob Marshall Wilderness between 1989 and 2024. The "Bob" is Montana's largest wilderness area and named after forester and founder of The Wilderness Society. Fire has shaped the landscape in recent years. *Photo courtesy of Evan Hjerpe.*We will start off by loading packages (install any that you need to) and bringing in the NLCD data that I have extracted for Montana, Idaho, and Wyoming. After bringing in the data, I remove some of information and built-in colors, which create issues in R. These steps are not necessary, but they clean up the data and allow us to more cleanly use the standard NLCD colors. Full disclosure: ChatGPT helped me figure this part out. After we get that set up, plot the land cover data for both years.```{r}# Load packages (install if you need to)library(terra)library(FedData)library(tidyverse)library(tigris)library(sf)library(mapview)library(RColorBrewer)library(landscapemetrics)library(ggiraph)# Bring data in for 1989 and 2024nlcd1989_MTIDWY <-rast("data/Lab7/NLCD_1989_MTIDWY.tif")nlcd2024_MTIDWY <-rast("data/Lab7/NLCD_2024_MTIDWY.tif")# These next steps are tweaking the data levels(nlcd1989_MTIDWY) <-NULLlevels(nlcd2024_MTIDWY) <-NULL# drop color tables from both layerscoltab(nlcd1989_MTIDWY) <-NULLcoltab(nlcd2024_MTIDWY) <-NULL# create a new table called "nlcd_classes" based on the nlcd_colors()nlcd_classes <- FedData::nlcd_colors() %>% dplyr::select(ID, Class)# assign the levels of the NLCD data using the classes we just madelevels(nlcd1989_MTIDWY) <- nlcd_classeslevels(nlcd2024_MTIDWY) <- nlcd_classes# assign the coltab (color table) using the nlcd_color() functioncoltab(nlcd1989_MTIDWY) <-with(FedData::nlcd_colors(), data.frame(value = ID, R =col2rgb(Color)[1,],G =col2rgb(Color)[2,],B =col2rgb(Color)[3,]))coltab(nlcd2024_MTIDWY) <-with(FedData::nlcd_colors(), data.frame(value = ID, R =col2rgb(Color)[1,],G =col2rgb(Color)[2,],B =col2rgb(Color)[3,]))# Look at the maps# This will show land cover data for Montana, Idaho, and Wyoming for 1989 and 2024.par(mfrow =c(1, 2))plot(nlcd1989_MTIDWY)plot(nlcd2024_MTIDWY)dev.off()```Bring in the wilderness data for Montana, Idaho, and Wyoming, project it so that the crs matches the NLCD data, and plot over top of land cover data. In previous labs, we have used `vect()` to import polygon data as shapefiles. This could work here too, but instead we will use `st_read()` using the `sf` package function. It is easier to use `dplyr` function with `sf` objects.```{r}# Bring in the shapefile of wilderness areas in Montana, Idaho, and Wyoming.nwps <- sf::st_read("data/Lab7/nwps_MTIDWY.shp")# Do the coordinate reference systems match the NLCD data?crs(nwps) ==crs(nlcd1989_MTIDWY)# transform (project) the NWPS data so that it matches the crs of the NLCDnwpsPRJ <-st_transform(nwps, crs(nlcd1989_MTIDWY))# Plot the 1989 NLCD and then the wilderness areas on top of it.# This will show land cover data for Montana, Idaho, and Wyoming for 1989 with wilderness areas plotted onto the map.plot(nlcd1989_MTIDWY)plot(nwpsPRJ, add = T, col =NA)```Now, we need to choose a wilderness area for our investigation. Remember, we're interested in how land cover has changed between 1989 and 2024. We will start off investigating patterns in the Bob Marshall Wilderness, which has experience a lot of fire in the last 30 years.```{r}# Select a Wilderness Area using dplyr's filter, which is nice.bob <- nwpsPRJ %>% dplyr::filter(NAME =="Bob Marshall Wilderness")# Extract the land cover data for both years to the Bob boundary.bob_nlcd_2024 <- nlcd2024_MTIDWY %>%crop(bob) %>%mask(bob)bob_nlcd_1989 <- nlcd1989_MTIDWY %>%crop(bob) %>%mask(bob)# Plot the land cover data for the Bob.# This will show land cover data for the Bob Marshall Wilderness for 1989 and 2024.par(mfrow =c(1, 2))plot(bob_nlcd_1989, axes = F)plot(bob_nlcd_2024, axes = F)dev.off()```Look at the maps of land cover for 1989 and 2024. What do you notice? Has the composition and patterns of land cover changed? Why?Let's quantify this. We'll start just using `freq()` to calculate a frequency table of land cover types. Recall this is how we investigated the composition of land cover types in an earlier lab.```{r}# Look at the frequency (number of pixels) in different land cover classes.freq(bob_nlcd_1989)freq(bob_nlcd_2024)```Let's stack these two year's of data up to make it easier to work with. It is always nice to "take control" of the names in raster stacks, so let's rename the stacks "lc1989" and "lc2024".```{r}# Stack the two years of data and rename the layersbob_nlcd <-c(bob_nlcd_1989, bob_nlcd_2024)names(bob_nlcd) <-c("lc1989", "lc2024")```Rather than using `freq()`, let's use `landscapemetrics` function `lsm_c_pland`. Recall that this calculates the proportion of the landscape in specific classes.```{r}# Run landscapemetrics' "pland" (% of landscape) metriclandscapemetrics::lsm_c_pland(bob_nlcd)```What has changed and by how much? What do you think about President's Johnson's comments about protecting wilderness that is unchanging?::: {.callout-tip appearance="minimal"}**TASK 1.**Calculate other landscape, class, or patch metrics for the Bob Marshall Wilderness and discuss the causes and possible consequences of these changes for ecological processes. Do these changes challenge the notion of wilderness as unchanging? Does this matter to management of wilderness or the establishment of new wilderness areas? Write up your results as an abstract for *Landscape Ecology*.ORRun `ls_c_pland` and the other landscape metric for another wilderness area, discuss the causes and possible consequences. As above, consider your results in the context of wilderness policy. Write up your results as an abstract for *Landscape Ecology*.:::# Projected land cover in U.S. ecoregionsIn addition to observed historical change, we will explore forecasted land cover scenarios developed by Terry Sohl and colleagues at the [USGS EROS Center](https://www.usgs.gov/earth-resources-observation-and-science-eros-center). These models simulate potential future land cover to 2100 under alternative socioeconomic and policy scenarios (e.g., A1B – high economic growth and globalization, and B2 – lower growth emphasizing regional sustainability). The projections use suitability maps and patch-growing algorithms to represent spatially explicit land use and land cover change. These algorithms also include empirical transition probabilities (based on observed historical change) and scenario-specific assumptions about population growth, policy, and land use. I have selected data for 2010, 2020, 2030, 2040, 2050, 2060, 2070, 2080, 2090, and 2100 to investigate changes in decade time steps. *Figure by Travis Belote using FORE-SCE data from Sohl et al. 2014, Ecological Applications 24(5):1015–1036. https://doi.org/10.1890/13-1245.1*These projections allow us to visualize and quantify how different policies or economic futures could shape U.S. landscapes. For example, where do forests expand or contract, or how agricultural and urban land use spread given "story lines" of population growth and demand for different goods? We will focus on selected Level IV ecoregions to explore these modeled futures and quantify changes in land cover composition using landscape metrics. We will pay particular attention to how the different scenarios affect the results.We will start off using `list.files` telling R to find files with the .tif file extension using `pattern = ".tif$"`. We also want the full names of the files so we can easily bring them in and stack them, so we will using `full.names = TRUE`.```{r}# Future predictions of land cover change# Data were downloaded from here: # https://www.sciencebase.gov/catalog/item/5b96c2f9e4b0702d0e826f6d# list the files with .tif patterns and return the full namesfuture_lc_files <-list.files("data/Lab7/Sohl", pattern =".tif$", full.names =TRUE)# stack those files upfuture_lc <-rast(future_lc_files)# Go ahead and look at the files. How many layers are here? What do they represent?# This will show 16 maps of land cover predictions for the contiguous U.S. from 2010 to 2100 under two different scenarios (A1B and B2)plot(future_lc)# and look at any properties, if you're interested# Check the resolutionres(future_lc)```We want to investigate how land use and cover may change in specific ecoregions of the contiguous United States. We'll bring in Level IV ecoregions, look at the map of ecoregions, project them so that the CRS matches the land cover data, and use `mapview` to look around.```{r}# Bring in the ecoregions using sf::st_read()ecoreg <-st_read("data/Lab7/us_eco_l3_MTIDWY.shp")# Look at the map.# This is a plot of ecoregions in Montana, Idaho, and Montana.plot(st_geometry(ecoreg), col ="grey90")# Project the ecoregions so that the crs matches the land cover dataecoregPRJ <-st_transform(ecoreg, crs(future_lc))# you might look to see how many different Level IV ecoregions there are.# unique(ecoregPRJ$US_L4NAME)# Use mapview to look at the ecoregions, pan around, and # click on some to see their names.# This is a plot of ecoregions in Montana, Idaho, and Montana in an interactive map.if (knitr::is_html_output()) {mapview(ecoregPRJ, zcol ="US_L4NAME", col.regions =brewer.pal(8, "Set3"), legend =FALSE)} else {ggplot(ecoregPRJ) +geom_sf(aes(fill = US_L4NAME)) +scale_fill_brewer(palette ="Set3", guide ="none") +theme_bw() +theme(axis.text =element_blank(), axis.ticks =element_blank())}```Let's see how Gallatin Valley might change in the next 75 years. The Gallatin Valley is part of the ecoregion called the Townsend Basin. Let's pull that ecoregion in and use it to clip the land cover data.```{r}# "Pull" the ecoregion called "Townsend Basin"townsend_basin <- ecoregPRJ %>% dplyr::filter(US_L4NAME =="Townsend Basin")# Clip the land cover data to the Townsend Basin ecoregiontownsend_b_lcc <- future_lc %>%crop(townsend_basin) %>%mask(townsend_basin)# Look at the maps# This is a plot of 16 land cover predictions for the "Townsend Basin" ecoregion from 2010 to 2100 under two different scenarios (A1B and B2). plot(townsend_b_lcc)```Now that we have the data clipped to the Townsend Basin ecoregion, we will use landscape metrics to assess the composition through time using `lsm_c_pland` (percent of landscape).```{r}# calculate the percent of the landsacpe that is in different classeseco_pland <- landscapemetrics::lsm_c_pland(townsend_b_lcc)```I have created a lookup table the lumped NLCD classes that Sohl et al. used. Bring that csv in.```{r}# Bring in the table of lumped NLCD names to join with the analysis. lc_names <-read.csv("data/Lab7/FORE_SCE_17class_lookup.csv")View(lc_names)```Now, use join this table to the landscape metrics output so that we can assess how changes in land cover using the names instead of the code.```{r}# We will join the output from above to the table of land cover names.eco_pland <- eco_pland %>%left_join(lc_names, by ="class")```We also want to recode the layer names to be meaningful. Look at the names from the stack and write them out here. After that, let's create a new variable identifying the year and another identifying the scenario. It will be useful to have "year" and "scenario" separated when we analyze the patterns. We will use `str_sub` from `stringr` in the `tidyverse` to do this.```{r}names(future_lc)eco_pland$year_scenario <-recode(eco_pland$layer,`1`="2010_A1B",`2`="2020_A1B",`3`="2030_A1B",`4`="2040_A1B",`5`="2050_A1B",`6`="2060_A1B",`7`="2070_A1B",`8`="2080_A1B",`9`="2090_A1B",`10`="2100_A1B",`11`="2010_B2",`12`="2020_B2",`13`="2030_B2",`14`="2040_B2",`15`="2050_B2",`16`="2060_B2",`17`="2070_B2",`18`="2080_B2",`19`="2090_B2",`20`="2100_B2")# Create a new variable called "year" and use the code above to get the yeareco_pland$year <-as.numeric(str_sub(eco_pland$year_scenario, 1, 4))# Create a new variable called "scenario". eco_pland$scenario <-str_sub(eco_pland$year_scenario, 6, 8)```Let's use the hexbin colors from the lookup table to create a color lookup for plotting. This ensure that our plots of land cover classes will use the same colors as in the maps. Keeping your colors in maps and figures consistent makes reading and analysis much cleaner.```{r}colors <- eco_pland %>%distinct(Land_Cover_Class, hex) %>%pull(hex, name = Land_Cover_Class)```Let's plot the percent of the landscape (the Townsend Basin ecoregion) through time only for the A1B scenario. We'll start by using filter to get only A1B, then plot year on the x-axis and "value" on the y-axis. Recall that "value" in the output from `ls_c_pland` is the class metric "percent of the landscape".```{r}# Plot percent of the landscape ("value") across years only for the A1B scenario.# Assign the different land cover classes the colors we made above. # This shows a line graph of % of the Townsend Basin ecoregion in 16 different land cover classes from 2010 to 2100. eco_pland %>% dplyr::filter(scenario =="A1B") %>%ggplot(aes(x = year, y = value, color = Land_Cover_Class)) +geom_line(lwd =1) +scale_color_manual(values = colors, name ="Land Cover") +ylab("% of ecoregion") +xlab("Year") +theme_bw()```Now, let's keep the two scenarios and "facet" them so that we can compare patterns through time among the different scenarios.```{r}# Plot percent of the landscape ("value") across years for both scenarios using # facet_grid# # This shows a line graph of % of the Townsend Basin ecoregion in 16 different land cover classes from 2010 to 2100 for 2 future scenarios (A1B and B2).eco_pland %>%ggplot(aes(x = year, y = value, color = Land_Cover_Class)) +geom_line_interactive(aes(tooltip = Land_Cover_Class), linewidth =1) +scale_color_manual(values = colors, name ="Land Cover") +facet_grid(~scenario) +ylab("% of ecoregion") +xlab("Year") +theme_bw()```::: {.callout-tip appearance="minimal"}**TASK 2.**Choose another ecoregion and re-run the analysis above. Discuss what the projections might mean for some ecological process or conservation issue. Write up your results as an abstract for *Landscape Ecology*.:::# Data source(s)Annual National Land Cover Database, which can be downloaded [here](https://www.mrlc.gov/data?f%5B0%5D=project_tax_term_term_parents_tax_term_name%3AAnnual%20NLCD).Projected land cover data from 1992 to 2100 can be downloaded [here](https://www.sciencebase.gov/catalog/item/5b96c2f9e4b0702d0e826f6d).National Wilderness Preservation System (wilderness areas) can be downloaded [here](https://wilderness.net/visit-wilderness/gis-gps.php).Level IV ecoregions can be downloaded [here](https://www.epa.gov/eco-research/level-iii-and-iv-ecoregions-continental-united-states).