class: left, middle, inverse background-image: url("https://live.staticflickr.com/65535/50362989122_a8ee154fea_k_d.jpg") background-size: cover # .orange[Habitat Analysis] ### .fancy[Types, Composition, and Configuration
] --- class: top background-image: url("https://live.staticflickr.com/65535/51083828531_e6d0965d5c_k_d.jpg") background-size: cover # What is a Landscape? --- # Landscapes > A landscape is a mosaic of interacting ecosystems which are heterogeneous in at least one factor of interest. > — Ecologist -- > The spatial distribution of suitable habitat > — All Other Living Things -- .redinline[The same physical location may be (to different organisms) several overlapping or independent landscapes.] --- class: sectionTitle, inverse # .orange[Habitat Quantification] ## .fancy[Quantifying Space On .redinline[*This*] Planet.] --- # Types of Quantification ### General `\(\to\)` Specific - *Landscape Type* : The categories (e.g., `factor`) of landscape features present in the study area. - *Landscape Composition* : The relative frequency of landscape features types in this area. - *Landscape Configuration* : The spatial arrangement of landscape features on the earth. --- .pull-left[ # Organismal Perspective We *must* remember that when we are looking at habitats, it is done so *only* from the perspective of the organism we are studying. - Temporal Scale - Spatial Scale These are entirely .redinline[*independent*] of what our scales are or what the scale of the closest raster just happens to be. See also: *Metasequoia glyptostroboides* ] .pull-right[ <img src="https://live.staticflickr.com/65535/51084359331_683f527fc3_c_d.jpg" height="600" style="display: block; margin: auto;" /> ] --- # Scale At a base level, spatial and temporal scales may be unique to each landscape feature. .pull-left[ <img src="https://live.staticflickr.com/65535/50999448554_b561b2138a_c_d.jpg" height="400" style="display: block; margin: auto;" /> ] .pull-right[ <img src="https://live.staticflickr.com/65535/51084723036_85b49100e4_c_d.jpg" height="400" style="display: block; margin: auto;" /> ] --- class: top # Granularity - Proper Pixel Size <img src="slides_files/figure-html/unnamed-chunk-4-1.png" width="504" height="600" style="display: block; margin: auto;" /> --- .left-column[ # Intensity How .redinline[much] does the feature influence the organism. ] .right-column[ <img src="https://live.staticflickr.com/65535/51016826740_ee1cf72271_c_d.jpg" height="500" style="display: block; margin: auto;" /> ] --- class: sectionTitle, inverse # .green[Case Study] ## .fancy[Lanscape Change In The Piedmont] --- background-image: url("https://live.staticflickr.com/65535/50998498169_0e502bc7ba_c_d.jpg") background-size: cover --- # Quantifying Landscape Use Besides .redinline[very tall ladders], our ability to map out the characteristics of specific regions on the planet are dictated by the availability of raster databases. .center[[![mrlc logo](https://live.staticflickr.com/65535/51016602045_a59cd29c90_o_d.png)](mrlc.gov)] --- # Raster Sources .pull-left[ The MRLC provides an interactive mapping tool to provide access to locations. Base rasters are available but are .redinline[HUGE] (e.g, 25Gb and larger) and you'd be doing a lot of *download `\(\to\)` open in R `\(\to\)` define boundary box `\(\to\)` crop `\(\to\)` save* IF (and this is a big if), you laptop does not crumble due to size of the data sets first... Consequently, the use of the interactive viewer at https://www.mrlc.gov/viewer/ is a great resources. ] .pull-right[ <img src="https://live.staticflickr.com/65535/51014241625_f0894ec432_c_d.jpg" style="display: block; margin: auto;" /> ] --- # Loading MRLC Data MRLC Data comes as a set of GEOTiff objects, which I've uploaded to the class GitHub account. ```r library( raster ) land_2016_url <- "https://github.com/dyerlab/ENVS-Lectures/raw/master/data/NLCD_2016_Land_Cover_L48_20190424_qn2B1f8ganicJNKnJN0e.tiff" land_2016 <- raster( land_2016_url ) land_2016 ``` ``` ## class : RasterLayer ## dimensions : 82, 83, 6806 (nrow, ncol, ncell) ## resolution : 30, 30 (x, y) ## extent : 1637235, 1639725, 1749465, 1751925 (xmin, xmax, ymin, ymax) ## crs : +proj=aea +lat_0=23 +lon_0=-96 +lat_1=29.5 +lat_2=45.5 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs ## source : https://github.com/dyerlab/ENVS-Lectures/raw/master/data/NLCD_2016_Land_Cover_L48_20190424_qn2B1f8ganicJNKnJN0e.tiff ## names : NLCD_2016_Land_Cover_L48_20190424_qn2B1f8ganicJNKnJN0e ## values : 11, 95 (min, max) ``` --- .pull-left[ # MRLC Plot You can use the normal `plot()` function (but for some reason it produces an extraneous empty plot for this one) or use our old friend `ggplot2()`. ```r rasterToPoints( land_2016) %>% as.data.frame() %>% mutate( LC = factor( NLCD_2016_Land_Cover_L48_20190424_qn2B1f8ganicJNKnJN0e )) %>% ggplot( aes(x,y,fill=LC)) + geom_raster() + theme_void() ``` ] .pull-right[ <img src="slides_files/figure-html/unnamed-chunk-9-1.png" width="504" style="display: block; margin: auto;" /> ] --- class: sectionTitle, inverse # .orange[Habitat Quantification] ## .fancy[Quantifying Space On .redinline[*This*] Planet.] --- # Landscape Type ```r values( land_2016 ) %>% table() ``` ``` ## . ## 11 21 22 23 31 41 42 43 52 71 82 90 95 ## 824 283 14 2 24 628 1519 1524 144 8 732 950 154 ``` --- .pull-left[ # Make It Usable For *historical* reasons, much of the data that we work with is defined using numeric codes needing *look-up tables* to format into output that can be interpreted by humans. When you download the raw data, it provides a [CSV file legend](https://raw.githubusercontent.com/dyerlab/ENVS-Lectures/master/data/NLCD_landcover_legend_2018_12_17_qn2B1f8ganicJNKnJN0e.csv) to translate these numbers into real-world feature names. ```r legend_url <- "https://raw.githubusercontent.com/dyerlab/ENVS-Lectures/master/data/NLCD_landcover_legend_2018_12_17_qn2B1f8ganicJNKnJN0e.csv" read_csv( legend_url ) %>% filter( !is.na(Legend)) ``` ] .pull-right[ <table class="table" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:right;"> Code </th> <th style="text-align:left;"> Legend </th> </tr> </thead> <tbody> <tr> <td style="text-align:right;"> 0 </td> <td style="text-align:left;"> Unclassified </td> </tr> <tr> <td style="text-align:right;"> 11 </td> <td style="text-align:left;"> Open Water </td> </tr> <tr> <td style="text-align:right;"> 12 </td> <td style="text-align:left;"> Perennial Snow/Ice </td> </tr> <tr> <td style="text-align:right;"> 21 </td> <td style="text-align:left;"> Developed, Open Space </td> </tr> <tr> <td style="text-align:right;"> 22 </td> <td style="text-align:left;"> Developed, Low Intensity </td> </tr> <tr> <td style="text-align:right;"> 23 </td> <td style="text-align:left;"> Developed, Medium Intensity </td> </tr> <tr> <td style="text-align:right;"> 24 </td> <td style="text-align:left;"> Developed, High Intensity </td> </tr> <tr> <td style="text-align:right;"> 31 </td> <td style="text-align:left;"> Barren Land </td> </tr> <tr> <td style="text-align:right;"> 41 </td> <td style="text-align:left;"> Deciduous Forest </td> </tr> <tr> <td style="text-align:right;"> 42 </td> <td style="text-align:left;"> Evergreen Forest </td> </tr> <tr> <td style="text-align:right;"> 43 </td> <td style="text-align:left;"> Mixed Forest </td> </tr> <tr> <td style="text-align:right;"> 52 </td> <td style="text-align:left;"> Shrub/Scrub </td> </tr> <tr> <td style="text-align:right;"> 71 </td> <td style="text-align:left;"> Herbaceuous </td> </tr> <tr> <td style="text-align:right;"> 81 </td> <td style="text-align:left;"> Hay/Pasture </td> </tr> <tr> <td style="text-align:right;"> 82 </td> <td style="text-align:left;"> Cultivated Crops </td> </tr> <tr> <td style="text-align:right;"> 90 </td> <td style="text-align:left;"> Woody Wetlands </td> </tr> <tr> <td style="text-align:right;"> 95 </td> <td style="text-align:left;"> Emergent Herbaceuous Wetlands </td> </tr> </tbody> </table> ] --- # Level 1 Quantification - Landscape Types Which landscape features are present? .pull-left[ ```r values( land_2016 ) %>% as.data.frame() %>% rename( "Code" = !!names(.[1])) %>% distinct() %>% left_join( legend, by = "Code") %>% arrange( Legend ) ``` ] .pull-right[ ``` ## Code Legend ## 1 31 Barren Land ## 2 82 Cultivated Crops ## 3 41 Deciduous Forest ## 4 22 Developed, Low Intensity ## 5 23 Developed, Medium Intensity ## 6 21 Developed, Open Space ## 7 95 Emergent Herbaceuous Wetlands ## 8 42 Evergreen Forest ## 9 71 Herbaceuous ## 10 43 Mixed Forest ## 11 11 Open Water ## 12 52 Shrub/Scrub ## 13 90 Woody Wetlands ``` ] --- # Level 2 - Landscape Composition .pull-left[ What are the relative frequencies of each type? ```r values( land_2016 ) %>% table() %>% as.data.frame() %>% rename( Code = !!names(.[1]), Frequency = Freq) %>% mutate( Code = as.numeric( as.character(Code ) ) ) %>% left_join( legend, by = "Code") %>% arrange( -Frequency ) ``` ] .pull-right[ <table class="table" style="margin-left: auto; margin-right: auto;"> <thead> <tr> <th style="text-align:right;"> Code </th> <th style="text-align:right;"> Frequency </th> <th style="text-align:left;"> Legend </th> </tr> </thead> <tbody> <tr> <td style="text-align:right;"> 43 </td> <td style="text-align:right;"> 1524 </td> <td style="text-align:left;"> Mixed Forest </td> </tr> <tr> <td style="text-align:right;"> 42 </td> <td style="text-align:right;"> 1519 </td> <td style="text-align:left;"> Evergreen Forest </td> </tr> <tr> <td style="text-align:right;"> 90 </td> <td style="text-align:right;"> 950 </td> <td style="text-align:left;"> Woody Wetlands </td> </tr> <tr> <td style="text-align:right;"> 11 </td> <td style="text-align:right;"> 824 </td> <td style="text-align:left;"> Open Water </td> </tr> <tr> <td style="text-align:right;"> 82 </td> <td style="text-align:right;"> 732 </td> <td style="text-align:left;"> Cultivated Crops </td> </tr> <tr> <td style="text-align:right;"> 41 </td> <td style="text-align:right;"> 628 </td> <td style="text-align:left;"> Deciduous Forest </td> </tr> <tr> <td style="text-align:right;"> 21 </td> <td style="text-align:right;"> 283 </td> <td style="text-align:left;"> Developed, Open Space </td> </tr> <tr> <td style="text-align:right;"> 95 </td> <td style="text-align:right;"> 154 </td> <td style="text-align:left;"> Emergent Herbaceuous Wetlands </td> </tr> <tr> <td style="text-align:right;"> 52 </td> <td style="text-align:right;"> 144 </td> <td style="text-align:left;"> Shrub/Scrub </td> </tr> <tr> <td style="text-align:right;"> 31 </td> <td style="text-align:right;"> 24 </td> <td style="text-align:left;"> Barren Land </td> </tr> <tr> <td style="text-align:right;"> 22 </td> <td style="text-align:right;"> 14 </td> <td style="text-align:left;"> Developed, Low Intensity </td> </tr> <tr> <td style="text-align:right;"> 71 </td> <td style="text-align:right;"> 8 </td> <td style="text-align:left;"> Herbaceuous </td> </tr> <tr> <td style="text-align:right;"> 23 </td> <td style="text-align:right;"> 2 </td> <td style="text-align:left;"> Developed, Medium Intensity </td> </tr> </tbody> </table> ] --- # Level 3 - Spatial Configuration There are *a lot* more metrics that we can estimate from landscape features than just identity and frequency and what we will be covering here is just a bit off the top. We can loosely categorize the kinds of metrics into the following groups: - Aggregation metrics - Area & Edge metrics - Contrast metrics - Core area metrics - Diversity metrics - Isolation metrics - Shape metrics - Subdivision metrics --- # Landscape Metrics Package ```r library( landscapemetrics ) ``` There are some requirements for your raster to use this library: 1. The distance units of your projection are meter, as the package converts units internally and returns results in either meters, square meters or hectares. For more information see the help file of each function. 2. Your raster encodes landscape classes as integers (1, 2, 3, 4, …, n). 3. Landscape metrics describe categorical landscapes, that means that your landscape needs to be classified (we throw a warning if you have more than 30 classes to make sure you work with a classified landscape). --- # Built-In Checks To check the applicability of your raster, there are some helper functions that provide feedback to you. ```r check_landscape( landscapemetrics::podlasie_ccilc ) ``` ``` ## layer crs units class n_classes OK ## 1 1 geographic degrees integer 14 x ``` -- Fortunately, this package was written with the MRLC data sets. ```r check_landscape( land_2016 ) ``` ``` ## layer crs units class n_classes OK ## 1 1 projected m integer 13 ✓ ``` --- # Nested Levels of Metrics This library breaks up the functions into the following nested levels: class, patch, landscape
--- # Landscape Metric Naming Conventions The functions in this library are named with the following taxonomy. `lsm_{l|p|c}_metric()` where `{l|p|c}` is one of `l`, `p`, or `c` and the metric is the name as shown above. So, for example, if we are looking at the area of each patch in the landscape we would use the function -- .pull-left[ ```r lsm_p_area( land_2016 ) ``` ``` ## # A tibble: 193 x 6 ## layer level class id metric value ## <int> <chr> <int> <int> <chr> <dbl> ## 1 1 patch 11 1 area 70.4 ## 2 1 patch 11 2 area 0.18 ## 3 1 patch 11 3 area 0.18 ## 4 1 patch 11 4 area 0.18 ## 5 1 patch 11 5 area 1.17 ## 6 1 patch 11 6 area 0.18 ## 7 1 patch 11 7 area 0.18 ## 8 1 patch 11 8 area 0.36 ## 9 1 patch 11 9 area 0.27 ## 10 1 patch 11 10 area 1.08 ## # … with 183 more rows ``` ] .pull-right[ The output provides the following components: - layers: See `?stack` for raster stacks - level: The nested level of the analysis (lpc) - class: The landscape feature class from the raster - id: A unique identification number for each group - metric: What is being measured. - value: The estimated value for the analysis. ] --- # Case Study - Summary of Forest Types .pull-left[ ```r lsm_p_area( land_2016 ) %>% filter( class %in% c(42, 43) ) %>% mutate( Forest = ifelse( class == 42, "Evergreen", "Mixed Hardwoods") ) %>% ggplot( aes(value) ) + geom_density() + facet_grid( Forest ~ .) + xlab("Area (ha)") + ylab("Frequency") + ggtitle("Area Distribution of Mixed Forest Types") ``` ] .pull-right[ <img src="slides_files/figure-html/unnamed-chunk-23-1.png" width="504" style="display: block; margin: auto;" /> ] --- # Other Metrics of Interest - *gyrate* - The mean distance between cells within it which approximates something like the average distance an organism can move within a patch before encountering a boundary. - *ca* - The physical area associated with each landscape type. - *clump* - A measure of how spatially contingent the features are ranging from random (no clumping) to all in one large patch (fully clumped). - *pr* - Patch richness. - *shdi* - Shannon's Diversity index --- # Finding Patches by ID ```r lsm_p_area( land_2016 ) %>% group_by( class ) %>% summarize( `Area` = sum( value) ) %>% arrange(-Area) ``` ``` ## # A tibble: 13 x 2 ## class Area ## <int> <dbl> ## 1 43 137. ## 2 42 137. ## 3 90 85.5 ## 4 11 74.2 ## 5 82 65.9 ## 6 41 56.5 ## 7 21 25.5 ## 8 95 13.9 ## 9 52 13.0 ## 10 31 2.16 ## 11 22 1.26 ## 12 71 0.72 ## 13 23 0.18 ``` --- # Evergreen Forests .pull-left[ ```r get_patches( land_2016, class=42)[[1]] %>% plot( ) ``` ] .pull-right[ <img src="slides_files/figure-html/unnamed-chunk-26-1.png" width="504" style="display: block; margin: auto;" /> ] --- # Mixed Forests .pull-left[ ```r get_patches( land_2016, class=43)[[1]] %>% plot( ) ``` ] .pull-right[ <img src="slides_files/figure-html/unnamed-chunk-28-1.png" width="504" style="display: block; margin: auto;" /> ] --- # Woody Wetlands .pull-left[ ```r get_patches( land_2016, class=90)[[1]] %>% plot( ) ``` ] .pull-right[ <img src="slides_files/figure-html/unnamed-chunk-30-1.png" width="504" style="display: block; margin: auto;" /> ] --- class: middle background-image: url("images/contour.png") background-position: right background-size: auto .center[ # 🙋🏻♀️ Questions? ![Peter Sellers](https://live.staticflickr.com/65535/50382906427_2845eb1861_o_d.gif+) ] <p> </p> .bottom[ If you have any questions for about the content presented herein, please feel free to [submit them to me](mailto://rjdyer@vcu.edu) and I'll get back to you as soon as possible.]