Due: 5pm Fri, Feb 27 2015 via GauchoSpace


In this lab, you’ll explore connectivity between species habitat patches using the software program CircuitScape. CircuitScape evaluates connectivity on a landscape based on two inputs:

You’ll create patches from the previous species distribution model outputs and then run and evaluate CircuitScape outputs using different resistance surfaces.

1 Download and Set Variables

After downloading lab7_connectivity.z to your course directory (eg H:\esm215). Right-click on lab7_connectivity.z -> 7-Zip -> Extract Here. Be sure that you have a folder like H:\esm215\lab7_connectivity containing lab7.Rmd. Right-click on lab7.Rmd -> Open with -> RStudio.

Set your working directory and scientific species names in R chunk below and Knit the document to generate patches and resistance surfaces.

wd            = 'H:/esm215/lab7_connectivity'
sp_scientific = 'Amphispiza belli'

2 Create Patches

To describe patches you’ll use the habitat from the previous species distribution lab for Santa Barbara County’s current climate, which relative to this lab’s working directory should be up one folder and in the scenario_04 subfolder: ../lab6_species/scenario_04/*_current_0.5min_sb.bil. You will need to have this output generated before proceeding.

As long as the file ../lab6_species/scenario_04/*_current_0.5min_sb.bil exists (where * is substituted with your species scientific name, spaces substituted with _), then the next R chunk should generate the following outputs:

The patches are generated by applying a the threshold from the species distribution model output that generates 10% habitat (pct_land = 0.10). Patches are dropped that have less than the minimum number of cells (min_cells = 4).

plot of chunk create_patches

3 Create Resistance Surfaces

The simplest resistance surface is to apply a constant value to every cell. The resistances between patches would then be proportional to Euclidean distance, since crossing any given cell incurs the same cost.

A common approach to creating resistance surfaces is to convert landcover to some biologically relevant resistance values. You’ll use the following table from Theobald (2012) ranging from null (0) to highest (100) resistance:

code nlcd_class resistance
0 No Data 0
11 Open Water 0
21 Developed, Open Space 52
22 Developed, Low Intensity 64
23 Developed, Medium Intensity 76
24 Developed, High Intensity 85
31 Barren Land (Rock/Sand/Clay) 24
41 Deciduous Forest 7
42 Evergreen Forest 7
43 Mixed Forest 7
52 Shrub/Scrub 5
71 Grassland/Herbaceous 17
81 Pasture/Hay 56
82 Cultivated Crops 68
90 Woody Wetlands 11
95 Emergent Herbaceous Wetlands 11

A common major obstacle is roads. The major roads (freeways and highways) have been extracted to vector/roads.shp. These get converted to raster and “burned” into the NLCD converted raster with a value of 100.

The final resistance surfaces to be generated by the following R chunk are:

plot of chunk create_resistancesplot of chunk create_resistancesplot of chunk create_resistances

Question: In the code above, the roads shapefile gets converted to raster (with rasterize) and then “burned” into the NLCD resistance raster with the cover function from the raster library. Does the sequence of arguments matter with this function, and if so why? Lookup the help from this function (F1 with cursor in the function name of the editor, or type ?cover in Console) and try plotting the different inputs (eg plot(r_roads)) after running Chunks -> Run All, then selecting and running just that section of code.

Yes, the “cover” function overlays one raster on top of another. We must first rasterize the road shapefile before the cover function will merge it with the land cover data.

4 Circuitscape on Uniform 1 Resistance [scenario_01]

Now that you have the inputs prepared, you’re ready to run Circuitscape, which you can launch from the Start menu -> All Programs -> Science Apps -> Circuitscape. Parameterize this first scenario like so:

Here’s what the interface looks like for sp_scientific = 'Amphispiza belli':

When you click on Run you should see Circuitscape iterate through calculating resistance for each patch to patch combination.

The next R chunk will read in the output of the cumulative current.

plot of chunk plot_scenario_01

5 Circuitscape on NLCD Converted Resistance [scenario_02]

Now look at resistance using the NLCD converted surface that spatially varies. Parameterize just like the previous scenario except:

plot of chunk plot_scenario_02

6 Circuitscape on NLCD + Road Resistance [scenario_03]

Now look at resistance using the NLCD converted surface that spatially varies. Parameterize just like the previous scenario except:

plot of chunk plot_scenario_03

7 Circuitscape on Resistance with Underpass [scenario_04]

A sensible strategy for increasing connectivity of habitat patches for a terrestrial mobile animal is to identify the most significant barrier, such as a road, and restore, or drastically lower the resistance, of that barrier, such as with an underpass.

7.1 Locate Underpass

Let’s try this by interactively identifying a road pixel on the previous road resistance surface. In order to see the map well, you’ll want to first resize the Plots window so it takes up the majority of the screen vertically and horizontally. For the interactive drawing of the point underpass to work, you’ll want to go to the RStudio menu Code -> Run Region -> Run All (or Ctrl+Alt+R keyboard shortcut) so the R code is run from the Console. (Note: Knitting the R Markdown document is not interactive.) Try to pick a point with only 1 pixel’s road width.

After interactively entering the point of the underpass, it is saved to vector/underpass.txt and a resistance surface is also generated with that pixel converted from 100 to 1 resistance raster/resistance_nlcd_roads_underpass.asc. (The interactive drawing of the underpass is presented if the file is not found, so you can also delete the file and Ctrl+Alt+R to interactively enter a new underpass point.)

plot of chunk draw_underpass

7.2 Run Circuitscape

Next, you’ll want to run Circuitscape as before, except on this new resistance surface with the underpass and output to a new scenario_04 folder:

  • Raster resistance: raster\resistance_nlcd_roads_underpass.asc

  • Base output: scenario_04\*.out where * is the scientific name of your species, with space replaced by underscore.