Due: 5pm Fri, Mar 20 2015 via GauchoSpace
In this conservation planning lab, you’ll work with software Marxan to select sites for a reserve network that maximise species richness while minimizing site selection cost. In previous labs, you built a single species distribution model, evaluated connectivity between species habitat patches and calculated community metrics for species diversity between sites. As explained by Watson et al (2011) from this week’s readings, site selection for a reserve network should include additional sites which are complimentary to existing sites for maximizing species diversity. This problem is generally formulated in one of two ways:
Minimum set problem. Given a set of sites with various species compositions and costs for selection, what is the minimum set of sites that represents all species at the lowest cost?
Maximal coverage problem. Given a budget limit to total cost of sites selected, what is the maximum coverage of species representation possible?
In practice, these conservation features of interest may be “fine filter” targets such as individual species, or “coarse filter” targets such as a general habitat (ie land cover class, or other environmental proxy).
Marxan uses the following input files [rows X columns] which you can find in the provided scenario_01/input
folder:
spp.csv
: conservation features listed by id, \(target\) amount and species penalty factor (\(spf\)) if target amount is unmet [species X properties]
pu.csv
: planning unit by id and \(cost\) for selecting in reserve network. Optional columns are: status (0=available; 1=included in initial reserve; 2=locked in; 3=excluded); xloc and yloc used by optional sepdistance in spp.csv. [planning units X properties]
pu_vs_spp.csv
: \(amount\) of species per planning unit [species * planning units X amount]
boundary.csv
\([\) optional \(]\): shared \(boundary\) length between planning units which gets dissolved as a function of the boundary length modifier (\(BLM\)) when used as an additional cost [planning units * planning units X boundary]
Marxan uses an objective function to minimize the value (\(V\)) of selecting sites, ie planning units, with minimal cost along with minimal penalty (\(spf\)) of excluding conservation feature targets:
\[ V = \sum_{pu_+} cost + \sum_{spp_-} spf + [BLM \sum_{pu_+} boundary] \]
where:
\(pu_+\) are all the planning units in selected reserve network
\(spp_-\) are all the conservation features whose target amount is not met by selected reserve network
Optionally, clumping of sites can be encouraged by penalizing more boundary length with the boundary length modifier (\(BLM\)). Boundaries that are shared between sites get dropped.
Set your working directory in the R chunk below.
For conservation features, you’ll use Maxent species distribution models from the 20 species selected by students in lab 6 (see data/lab6_species.csv
). For planning units, you’ll use hexagons roughly equivalent to pixels 4 x 4 km (edge = 2.3 km * 6 = 13.9 km; area = 13.9 km\(^2\)). The hexagon planning units are much bigger than the original Maxent outputs (0.5 minute), and also constrained to Santa Barbara County which is a tighter extent than the Maxent bounding box. The Maxent outputs were converted to binary based on a 20% threshold as with lab 6 and the proportion of presence pixels (versus not) assigned to the \(amount\) of species present in the pixel in the pu_vs_spp.csv
file. To see how these data were prepared, you can look at lab9_prep.R
which generated the data/pu.shp
and scenario_01/input
files for you.
Let’s look at our planning units (pu):
And our total species amounts per planning unit:
And table of species by sorted in descending order by sum of total amount:
species_id | name | amount_sum |
---|---|---|
8 | Buteo regalis | 450.364 |
20 | Solanum xanti | 427.140 |
19 | Sciurus griseus | 425.132 |
2 | Accipiter striatus | 417.392 |
7 | Athene cunicularia | 398.177 |
16 | Phrynosoma coronatum | 391.439 |
11 | Elanus leucurus | 356.974 |
15 | Passerina caerulea | 328.305 |
6 | Antrozous pallidus | 317.469 |
1 | Accipiter cooperii | 291.556 |
4 | Ammodramus savannarum | 274.460 |
14 | Mimulus aurantiacus | 259.778 |
13 | Lanius ludovicianus | 207.936 |
18 | Quercus parvula | 206.407 |
10 | Cnemidophorus tigris | 199.492 |
17 | Pinus muricata | 189.641 |
12 | Icteria virens | 178.191 |
5 | Amphispiza belli | 92.414 |
9 | Catharus ustulatus | 30.520 |
3 | Agelaius tricolor | 8.799 |
Notice that some species still have relatively low abundance. Let’s plot a few different species amounts to see the spatial differences…
For your first Marxan scenario scenario_01
, the input files have been created for you. Notice that the input paramaters (including paths to input files) are described in the input.dat
text file can be edited in a GUI by double-clicking on Inedit.exe
.
For quick tips on any of these parameters hover your cursor over the parameter. For thorough details, check out the manual and handbook in the references
folder.
For this scenario, you shouldn’t change any of the paramaters or input files. You just need to double-click the marxan.exe
executable inside the scenario_01
folder to run Marxan. You should see a black command window open and show log output of Marxan for each run.
Once it’s finished, you can press return to exit.
Look at the output files generated by running Marxan, with dimensions [rows X columns] given for csv files:
DebugTraceFile_MarOpt.txt
: log output for debugging any errorsMarOptTotalAreas.csv
: initial total values for occurrence and amount of species across planning unitsoutput/
out_best.txt
(csv): best run solution (0=excluded; 1=included) [planning units X solution]out_log.dat
: log output also to command windowout_mvbest.txt
(csv): summary of conservation feature amounts met by the best solution [species X properties]out_sen.dat
: scenario detailsout_ssoln.txt
(csv): sum of all run solutions, planning units by number (0 to # of runs) [planning units X number]out_sum.txt
(csv): summary of each run [runs X properties]Knit this document again to consume the Marxan outputs and plot a figure of the best solution (best) and sum of all solutions (ssoln), which for any planning unit has the maximum value of the number of runs. If a planning unit is at the max possible value of runs, then it may be considered “irreplacable” whereas the other planning units with lower values can be more flexibly swapped out to acheive a similar result.
## [1] "Marxan output file not found: scenario_01/output/out_best.txt"
Question: How many of the conservation features have their target amount met by the best solution?
Make a copy of scenario_01 and rename to scenario_02
. I recommend deleting the files inside the output
subfolder when you do this so you don’t get confused as to whether you ran Marxan yet or not for this scenario.
For this scenario, let’s explore the tradeoff between cost of planning units and penalty of not meeting conservation features. Based on the objective function (above equation), you would expect that if the cost of planning units was sufficiently high relative to the penalty of conservation features, you would get a best solution that would not meet all conservation feature targets, effectively switching the problem from a minimum set to maximum coverage problem.
Try this in by either increasing the cost of all planning units (pu.csv:cost = 1) or reducing the penalty of all conservation features (spp.csv:spf = 10) until you get an unmet conservation feature in the best solution, which you can quickly tell by any of the following methods:
in command window, scroll up to run of best solution, value to right of Missing
> 0? (quickest)
in output_mvbest.txt:“Target Met” column has a No?
in output_sum.txt:“Missing_Values” column for run of best solution > 0?
Until you get an unmet conservation feature target, sequence by orders of magnitude (ie cost 1 to 10 to 100…, or spf 10 to 1 to 0.1…). (I recommend doing this by double-clicking the file to open in Excel, updating the first value and using the lower-right of cell crosshair double-click trick to automatically fill down. Save the file to update CSV and disregard Excel’s suggestion to save in native format when closing.)
Knit again to plot the result below.
## [1] "Marxan output file not found: scenario_02/output/out_best.txt"
Question: At what combination of values for planning unit cost vs. conservation feature penalty did you get an unmet conservation feature in the selected set?
Question: Were more or fewer sites selected in the best solution than in scenario_01? Was there more or less flexibility in selection of sites between scenarios as evidenced in sum of solutions? Does this make sense to you based on the objective function?
Make a copies of scenario_01 and rename to scenario_03
, scenario_04
, scenario_05
. I recommend deleting the files inside the output
subfolder when you do this so you don’t get confused as to whether you ran Marxan yet or not for this scenario.
For these scenarios, you’ll investigate the use of the boundary length modifier to clump selected planning units. Use the Inedit.exe
to enter alternative values of BLM. Try 0.1, 1 and 10 for scenarios 3, 4 and 5 respectively.
## [1] "Marxan output file not found: scenario_03/output/out_best.txt"
## [1] "Marxan output file not found: scenario_04/output/out_best.txt"
## [1] "Marxan output file not found: scenario_05/output/out_best.txt"
Question: How many components (contiguous clusters of sites) are in each of your best solutions as a function of BLM?
For the next two scenarios, you’ll use the national landcover dataset (NLCD 2011) to impose higher planning unit cost on developed areas and add “coarse filter” habitats as additional conservation features.
The new spatially heterogenous planning unit cost values were extracted from the NLCD reclassifed by the values in data/nlcd_cost.csv
.
code | nlcd_class | pu_cost |
---|---|---|
0 | No Data | 0 |
11 | Open Water | 0 |
21 | Developed, Open Space | 50 |
22 | Developed, Low Intensity | 100 |
23 | Developed, Medium Intensity | 250 |
24 | Developed, High Intensity | 500 |
31 | Barren Land (Rock/Sand/Clay) | 0 |
41 | Deciduous Forest | 0 |
42 | Evergreen Forest | 0 |
43 | Mixed Forest | 0 |
52 | Shrub/Scrub | 0 |
71 | Grassland/Herbaceous | 0 |
81 | Pasture/Hay | 50 |
82 | Cultivated Crops | 50 |
90 | Woody Wetlands | 0 |
95 | Emergent Herbaceous Wetlands | 0 |
In the following three plots, you see:
the original landcover NLCD 2011 raster with the empty planning unit hexagons on top
the NLCD reclassified to cost using the table above, again with empty planning unit hexagons on top
the cost per hexagonal planning unit, which is the extracted average cost of pixels inside
Here’s a summary of the planning unit cost values:
min | mean | max | sum | n |
---|---|---|---|---|
0 | 9.934 | 160.6 | 4699 | 473 |
These new planning unit cost values have been saved to data/pu_cost.csv
. Use this alternative planning unit file as input to a new copy of scenario_01 as scenario_06
. You can either replace scenario_06/input/pu.csv
with data/pu_cost.csv
or copy it there and update the marxan input parameters (stored in input.dat
) by using the Inedit.exe
program inside scenario_06
and updating the path to pu_cost.csv
. After you run Marxan, knit this lab again to consume this scenario’s outputs and render the best and sum of solutions below.
## [1] "Marxan output file not found: scenario_06/output/out_best.txt"
Question: Based on this new spatially varying cost of planning unit, how do you expect the scenario_06 results to differ from scenario_01 and do you see any evidence of this in the output?
Next we’ll use landcover data to describe desirable habitats for input as additional conservation features. We need to use another lookup table to reclassify the landcover data into these new habitat id’s.
code | nlcd_class | id | name |
---|---|---|---|
41 | Deciduous Forest | 21 | forest |
42 | Evergreen Forest | 21 | forest |
43 | Mixed Forest | 21 | forest |
52 | Shrub/Scrub | 22 | shrub |
71 | Grassland/Herbaceous | 23 | grass |
90 | Woody Wetlands | 24 | wetland |
95 | Emergent Herbaceous Wetlands | 24 | wetland |
Here’s a summary of proportion of habitat across planning units:
habitat | n | min | mean | max | sum |
---|---|---|---|---|---|
forest | 440 | 3.253e-04 | 0.25648 | 0.9056 | 112.849 |
grass | 470 | 3.253e-04 | 0.16763 | 0.8264 | 78.788 |
shrub | 469 | 2.589e-04 | 0.42958 | 0.9663 | 201.474 |
wetland | 222 | 6.473e-05 | 0.01813 | 0.1759 | 4.025 |
Besides the habitat amounts extracted per planning unit (ie pu_vs_spp.csv
), we need to append these habitats into the conservation features file (ie spp.csv
) with explicit target amounts and species penalty factors (spf) for Marxan to use in its analysis:
id | target | spf | name |
---|---|---|---|
21 | 50 | 40 | forest |
22 | 20 | 20 | shrub |
23 | 20 | 20 | grass |
24 | 2 | 20 | wetland |
These new habitat values have been combined with the existing conservation targets and saved to spp_habitats.csv
(in format of spp.csv
) and pu_vs_spp_habitats.csv
(in format of pu_vs_spp.csv
). Use these alternative input files to run a new scenario_07 based on a copy of scenario_06 (similar to steps for setting up previous scenario). Run Marxan and knit again to consume the output and render the scenario output plots below.
## [1] "Marxan output file not found: scenario_07/output/out_best.txt"
Question: Based on these additional conservation features, how do you expect the scenario_07 results to differ from scenario_06 and do you see any evidence of this in the output?
Answer the questions above and be sure to include all your scenario_# best and ssoln output figures in your writeup.
Besides the manual and handbook in the references
folder, I recommend checking out this Marxan Tutorial organized into modules on: conservation principles, theory behind Marxan, Marxan information requirements, technical introduction, output, introduction to Zonae Cogito, and parameter setting.