allowNeighb: Implement neighbourhood decision rules

Description Usage Arguments Value See Also Examples

View source: R/allowNeighb.R

Description

Identify legitimate transitions for each cell according to neighbourhood decision rules.

Usage

1
allowNeighb(neighb, x, categories, rules, ...)

Arguments

neighb

a NeighbRasterStack object

x

a categorical RasterLayer to which neighbourhood rules should be applied. If neighb is supplied it is updated with this map

categories

numeric vector containing land use categories. If allowNeighb is called from an allocation model this argument should contain all categories in the simulation, regardless of whether they're associated with a neighbourhood decision rule

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 x@categories

...

additional arguments (none)

Value

A matrix.

See Also

allow, NeighbRasterStack

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
## Plum Island Ecosystems

## load observed land use data
obs <- ObsLulcRasterStack(x=pie,
                     pattern="lu",
                     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=obs[[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=obs[[1]],
                        categories=obs@categories,
                        rules=0.5)

## create raster showing cells allowed to change to forest
r <- obs[[1]]
r[!is.na(r)] <- nb.allow[,1]
plot(r)

## NB output is only useful when used within an allocation routine

lulcc documentation built on May 1, 2019, 7:05 p.m.