Description Usage Arguments Value See Also Examples
Identify legitimate transitions for each cell according to neighbourhood decision rules.
1 | allowNeighb(neighb, x, categories, rules, ...)
|
neighb |
a NeighbRasterStack object |
x |
a categorical RasterLayer to which neighbourhood rules should be
applied. If |
categories |
numeric vector containing land use categories. If
|
rules |
a numeric vector with neighbourhood decision rules. Each rule
is a value between 0 and 1 representing the threshold neighbourhood value
above which change is allowed. Rules should correspond with
|
... |
additional arguments (none) |
A matrix.
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 | ## Plum Island Ecosystems
## load observed land use maps
lu <- DiscreteLulcRasterStack(x=stack(pie[1:3]),
categories=c(1,2,3),
labels=c("Forest","Built","Other"),
t=c(0,6,14))
## create a NeighbRasterStack object for forest only
w <- matrix(data=1, nrow=3, ncol=3)
nb <- NeighbRasterStack(x=lu[[1]], weights=w, categories=1)
## only allow change to forest within neighbourhood of current forest cells
## note that rules can be any value between zero (less restrictive) and one
## (more restrictive)
nb.allow <- allowNeighb(neighb=nb,
x=lu[[1]],
categories=lu@categories,
rules=0.5)
## create raster showing cells allowed to change to forest
r <- lu[[1]]
r[!is.na(r)] <- nb.allow[,1]
plot(r)
## NB output is only useful when used within an allocation routine
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.