top of page

Sage grouse fence collision model tutorial

 

Calculates sage grouse fence collision risk following methods presented in Stevens et al., (2013)

 

Function arguments

x                              SpatialPointsDataFrame sp class object of lek locations

Y                              RasterLayer raster class object of elevation (DEM)

d                              Buffer distance (default to 3000m as defined in model)

pad                          pad d by raster resoultion ^2 to account for edge effect (TRUE/FALSE)

file.name                 Output file name, if specified results will be mosaiced into single raster

cleanup                   Delete lek-level rasters (TRUE/FALSE)

 

Results

Returns raster files in tiff format. If "file.name" is specified individual lek rasters are mosaiced into a single raster.

Expected estimate range 0-3 where; low risk 0-0.49, moderate risk 0.50-0.99, high risk >= 1

 

Methods

Uses point locations of sage-grouse leks and a 30m Digital Elevation Model with same extent and projection as lek data to run model. The procedural steps implemented in function are as follows:

 

  • Create a point layer representing sage-grouse lek locations.

  • Create dissolved lek buffers

  • Subset elevation raster to each buffer

  • Calculate terrain ruggedness index raster (Riley et al. 1999)

  • Calculate Euclidean distance to nearest lek(s)

  • Use TRI and distance to lek and apply the following regression equation to predict collision risk

 

Fence collision regression equation

    y = 78 * exp(β0 + β1 * tri + β2 * distance)

    where; β0 = -3.3254377759, β1 = -0.2504710567, β2 = -0.0006119843

 

References

 

Riley, S.J., S.D. DeGloria and R. Elliot (1999) A terrain ruggedness index that quantifies topographic heterogeneity, Intermountain Journal of Sciences 5(1-4):23-27.

 

Stevens, B. S., D.E. Naugle, B. Dennis, J.W. Connelly, T. Griffiths, and K. P. Reese (2013) Mapping sage-grouse fence-collision risk: Spatially explicit models for targeting conservation implementation. Wildlife Society Bulletin, 37(2):409-415

 

Model Tutorial

 

If needed, install sagegrouse R package (in windows you will need to run R as administrator by right clicking on R icon and selecting “Run as administrator”). The other library dependencies will install automatically.

 

    # set site library

    .Library.site <- file.path(chartr("\\", "/", R.home()), "library")

    .libPaths(file.path(chartr("\\", "/", R.home()), "library"))

 

    # set a CRAN mirror

    local({r <- getOption("repos")

       r["CRAN"] <- "http://cran.stat.ucla.edu/"

       options(repos=r)})

 

    install.packages("http://s3.amazonaws.com/sagegrouse/SGITools_0.1-0.zip ", type="binary", repos=NULL)

 

Add required libraries. It is also a good idea to set your working directory so you know where results are written to. I will use a dummy directory for example purposes. This code will check for package existence, if necessary install and the add the libraries to the current R session.

 

    if (!require("sp")) { install.packages("sp", dependencies = TRUE); library(sp) }

    if (!require("rgdal")) { install.packages("rgdal", dependencies = TRUE); library(rgdal) }

    if (!require("raster")) { install.packages("raster", dependencies = TRUE); library(raster) }

    library(SGITools)

 

    setwd("C:/mypath")

 

There are two example datasets included with the package, “leks” and “elev”.  

 

    data(leks) 

    data(elev)

 

To read data from disk you can use the rgdal and raster packages.

 

    #  library(rgdal)

    #  leks <- readOGR("C:/mypath ", "leks")

 

    #  library(raster)

    #  elev <- raster("C:/mypath/elev.tif ")

 

Here we subset the lek data to the example DEM. First we create an polygon from the extent of the DEM and buffer it by -3000 (inverse buffer). This is because the buffer distance for the model will be 3000m and we need to ensure that all subset leks have at leas 3000m to the edge of the raster.

 

    ext <- as(extent(elev), "SpatialPolygons")

    ext <- gBuffer(ext, width = -3000)

      proj4string(ext) <- proj4string(leks)

 

The intersect function will allow us to subset the lek points to the new extent.

 

    leks <- intersect(leks, ext)

 

Now we can run the fence collision model. Since each buffer generates a separate raster, we specify an output “fence_collision.tif” which will mosaic all the resulting rasters into a single raster. We also set the “cleanup” argument to TRUE so the individual rasters are deleted. After the model is finished we add the final raster and plot the results. 

 

    fence.collision(leks, elev, file.name = "fence_collision.tif", cleanup = TRUE) 

      fc <- raster("fence_collision.tif")

      plot(fc)

 

Here we classify the risk to 3 categories (low risk 0-0.49, moderate risk 0.50-0.99, high risk >= 1) using a custom function and ifelse.

 

    # function to reclassify the risk values

    rc <- function(x) {

       ifelse(x <= 0.49, 1,

         ifelse(x > 0.40 & x <= 0.99, 2,

           ifelse(x > 1, 3, NA)))

     }

 

We can now pass our function to calc and write a new raster “fence_collision_risk.tif”

 

    fc.class <- calc(fc, fun = rc, filename = "fence_collision_class.tif", overwrite = TRUE)

 

This will plot the classified raster with the lek locations overlaid with “green”, “yellow” and “red” symbology.

 

    plot(fc.class, col=c("green","yellow","red"), legend = FALSE)

      points(leks, pch = 20, cex = 0.75)

         legend("topright", legend=c("Low risk","Moderate risk","High risk"),

                          fill=c("green","yellow","red"))

    title("Sage grouse fence collision risk - Pinedale anticline, WY")

 

bottom of page