Description Usage Arguments Value Note Author(s) Examples
Calculates base soil loss given initial conditions for the factors.
1 | prepareRusle(spatialList, R, K, LS, C, shapes = NULL, shapeAttribute = NULL)
|
spatialList |
Output generated by |
R |
Rainfall erosivity factor raster |
K |
Soil erodibility factor raster |
LS |
Topographic slope length factor raster |
C |
Vegetative cover factor raster |
shapes |
Optional shapefile. If provided, simulation will return total soil loss relative to baseline as
aggregated to input polygons specified by shapefile. |
shapeAttribute |
Optional attribute. If provided along with |
List containing inputs used for soil loss simulation, rusle
. List contains
baseline input (R*K*LS*C) and C as matrices and optional input shapes for aggregated output.
Edited by CDMartinez 2 Feb 17
Created by CDMartinez 21 Oct 16
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 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)
prepSpatial <- prepareSimSpatial(surfaceRaster = rBase, shape, OGasmt)
dxdy <- 400
# Slope-length factor
tempI <- matrix(complex( real = rep(seq(0.4, .47, length.out = dxdy), each = dxdy ),
imag = rep(seq(.3, .42, length.out = dxdy), dxdy)), ncol= dxdy, nrow = dxdy)
tempZ <- 0
for(k in 1:20){tempZ <- tempZ^2+tempI}
rLS <- raster(exp(-abs(tempZ))*20)
extent(rLS) = extent(prepSpatial$rGrid)
# Vegetative cover factor
rC <- raster(matrix(sample(seq(.001, .05, length.out = 7),
size = dxdy, replace = TRUE), nrow = sqrt(dxdy)), xmn = -500,
xmx = 2500, ymn = -500, ymx = 2500)
# Soil erodibility factor
rK <- raster(matrix(sample(seq(.01, .7, length.out = 15),
size = dxdy, replace = TRUE), nrow = sqrt(dxdy)), xmn = -500,
xmx = 2500, ymn = -500, ymx = 2500)
# Rainfall erosivity
rR <- raster(matrix(rep(10, dxdy), nrow = sqrt(dxdy)),
xmn = -500, xmx = 2500, ymn = -500, ymx = 2500)
# Soil Loss will be aggregated across entire area
prepRusle <- prepareRusle(prepSpatial, R = rR, K = rK, LS = rLS, C = rC)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.