makeRoadsD: Create roads from distribution

Description Usage Arguments Details Value Author(s) Examples

Description

Default returns total road length. Function draws a segment length from a user provided distribution (roadDist) for each simulated pad (xyStarts). Total road length is equal to the sum of all segment lengths.

Usage

1
makeRoadsD(xyStarts, roadDist, totalLength = TRUE)

Arguments

xyStarts

Matrix of easting (1st column) and northing (2nd column) of new pad center locations. Corresponding eastings and northings assumed to be in the same row.

roadDist

Vector representing a distribution of road segment lengths. Length must be >= 2.

totalLength

Default value is TRUE and only the total length of roads is returned. If FALSE, a list containing the lengths of individual road segments are returned for each pad in addition to the total length of roads.

Details

User provided distribution of road segment lengths is sampled with replacement, where n = the number of simulated pads. Length must be >= 2, values must be >= zero.

Value

If totalLength is TRUE, the total length of road using the sum of the lengths of the individual road segments is returned. If totalLength is FALSE, a list containing the lengths of individual road segments are returned for each pad in addition to the total length of roads.

Author(s)

Created by MADorning 02-12-218

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
33
34
35
36
37
38
library(raster)
set.seed(46)
OGasmt <- continuousAssessment(auMC = 5,
auType = 'Gas',
auProbability = 1,
auAreaProductive = c(100,400,800),
auAreaDrainage = c(10,20,40),
auPercAreaUntested = c(93,96,99),
auPercAreaSweet = c(100,100,100),
auPercFutureSS = c(20,40,50),
auEURss = c(0.15,0.4,0.65),
auLGR = c(.08,.5,1),
year = 2016)

OGasmt <- convertAcre2sqMeter(OGasmt)

rBase <- raster(resolution = c(10,10), xmn = 0, xmx = 2000, ymn = 0, ymx = 2000)
values(rBase) <- sample(1:10, 40000, replace = TRUE)

points <- rbind(c(250,250),c(250,1750),c(1750,1750),c(1750,250),c(250,250))
shape <- SpatialPolygons(list(Polygons(list(Polygon(points)), 'auOutline')))

plot(rBase, xlim = c(0,2000), ylim = c(0,2000))
lines(shape)

spatialPrep <- prepareSimSpatial(surfaceRaster = rBase, shape, OGasmt)
distributionPrep <- prepareSimDistributions(spatialPrep,wellsPerPad = 3,
padArea = 500, EA = OGasmt, numIterations=5)

# Create road segment distribution (for roads option 2)

# Creat a vector of road segment lengths in meters
# Values must be >= 0 (vector must contain at least 2 numeric values)
prepRoadDist <- rnorm(nMC, mean = 500, sd = 100)
prepRoadDist[prepRoadDist < 0] <- 0

pads <- placePads(distributionPrep, 5)
roadLength <- makeRoadsD(xyStarts = pads$xyPadCenter, roadDist = prepRoadDist)

madorning/energySim0.1.0 documentation built on May 22, 2019, 2:23 p.m.