
Last chance! 50% off unlimited learning
Sale ends in
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).
flattenBrick(x, thresh = NULL, ...)
RasterBrick or RasterStack.
Numeric. Optional: threshold to apply to preceding values in deciding whether to mask subsequent values.
Additional arguments to be bassed to mc.calc
.
RasterLayer with values representing 'earliest' encountered values not exceeding thresh
.
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
.
# NOT RUN {
# 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)
# }
Run the code above in your browser using DataLab