apply_windowed: Apply a raster function with edge effects over a series of...

Description Usage Arguments Examples

View source: R/apply_windowed.R

Description

This function can be useful when applying windowed functions over a raster, as with glcm. This function allows windowed functions that have edge effects to be applied over a raster in block-by-block fashion. apply_windowed avoids the striping that would result if the edge effects were ignored.

Usage

1
2
apply_windowed(x, fun, edge = c(0, 0), chunksize = NULL, filename = "",
  overwrite = FALSE, datatype = "FLT4S", ...)

Arguments

x

a Raster*

fun

the function to apply

edge

length 2 numeric with number of rows on top and bottom with edge effects, defined as c(top, bottom)

chunksize

the number of rows to read per block (passed to raster blockSize function.

filename

file on disk to save Raster* to (optional)

overwrite

whether to overwrite any existing files (otherwise an error will be raised)

datatype

the raster datatype to use

...

additional arguments to pass to fun

Examples

1
2
3
4
5
6
7
## Not run: 
L5TSR_1986_b1 <- raster(L5TSR_1986, layer=1)
min_x <- cellStats(L5TSR_1986_b1, 'min')
max_x <- cellStats(L5TSR_1986_b1, 'max')
apply_windowed(L5TSR_1986_b1, glcm, edge=c(1, 3), min_x=min_x, max_x=max_x)

## End(Not run)

azvoleff/teamlucc documentation built on June 4, 2017, 12:08 a.m.