prepareChangeShape: Prepare Shapefile for Change Comparison

Description Usage Arguments Value Note Author(s) Examples

View source: R/impactFunctions.R

Description

Prepares a shapefile values and parameters for change comparison

Usage

1
prepareChangeShape(shape, shapeAttribute = NULL, spatialList)

Arguments

shape

The shapefile to prepare for simulation. Shapefile must have an attribute representing the surface classifications.

shapeAttribute

String providing the field name of the attribute to be used for classification.

spatialList

The list returned from prepareSimSpatial containing the base raster resolution to be used for conversion.

Value

List returned from prepareChangeRaster with the matrix version of raster with required spatial extents, number of classifications present, integer classification values

Note

Edited by CDMartinez 8 Feb 17

Author(s)

Created by CDMartinez 21 Oct 16

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
library(raster)
OGasmt = continuousAssessment(auMC = 50000,
auType = 'Gas',
auProbability = 1,
auAreaProductive = c(2220000,2800000,3742000),
auAreaDrainage = c(10,20,40),
auPercAreaUntested = c(93,96,99),
auPercAreaSweet = c(100,100,100),
auPercFutureSS = c(80,92,94),
auEURss = c(0.15,0.4,0.65),
auLGR = c(.08,.5,1),
year = 2012)

rBase = raster(resolution = c(10,10), xmn = 0, xmx = 100, ymn = 0, ymx = 100)
values(rBase) = seq(1:100)
points = rbind(c(30, 40), c(30, 50), c(40, 50), c(40, 60), c(50, 60), c(60, 60),
c(60, 50), c(50, 50), c(50, 40), c(40, 40), c(30, 40))
shape = spPolygons(points)

plot(rBase)
lines(shape)

prepSpatial = prepareSimSpatial(rBase,shape, OGasmt)

criticalArea <- SpatialPolygons(list(
Polygons(list(Polygon(rbind(c(0,500),c(1000,2000),c(1500,2000),c(0,0),c(0,500)))), 'A'),
Polygons(list(Polygon(rbind(c(1300,700),c(1100,950),c(900,700),c(1100,450),c(1300,700)))),'B')))
criticalAreaShape <- SpatialPolygonsDataFrame(criticalArea, data.frame(
Years = rbind(3,5), Designation = rbind('Wildlife Corridor', 'Nest Site'),
row.names = c('A','B')), match.ID = TRUE)
prepCriticalArea <- prepareChangeShape(shape = criticalAreaShape,
shapeAttribute = 'Designation', spatialList = prepSpatial)

madorning/energySimMD documentation built on May 22, 2019, 2:40 p.m.