flattenBrick: Convert a RasterBrick or RasterStack to a RasterLayer based...

Description Usage Arguments Details Value Author(s) Examples

Description

Flatten a brick by iteratively masking layer values by non-NA values in preceding layers. An optional threshold can be supplied, where preceding values exceeding the threshold are ignored in the masking procedure (and are therefore themselves removed).

Usage

1
flattenBrick(x, thresh = NULL, ...)

Arguments

x

RasterBrick or RasterStack.

thresh

Numeric. Optional: threshold to apply to preceding values in deciding whether to mask subsequent values.

...

Additional arguments to be bassed to mc.calc.

Details

thresh only works on a 'greater-than' basis. To achieve the reverse, first let x <- -1*x then convert the result back by y <- -1*y.

Value

RasterLayer with values representing 'earliest' encountered values not exceeding thresh.

Author(s)

Ben DeVries

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# load Tura dataset
data(tura)

## apply a very crude gap-fill using 2 Landsat
# the 1st layer has alot of gaps from the cloud mask
# suppose this is our target image and we want to use the 2nd layer to fill
# just take these two layers
gapfill <- tura[[c(1:2)]]
names(gapfill) <- c("target", "fill")
plot(gapfill)

# flatten the Brick to fill the gaps (NA's in the 1st layer)
filled <- flattenBrick(gapfill)
plot(filled)

loicdtx/bfastSpatial documentation built on May 21, 2019, 7:37 a.m.