timeStack: Creates a time stack of Landsat layers

Description Usage Arguments Author(s) Examples

Description

Creates a stack of Landsat layers, reordering them chronologically

Usage

1
timeStack(x, pattern = NULL, orderChrono = TRUE, ...)

Arguments

x

character. dir containing the files to be stacked or character list (the files). IN the former case, it is recommended to use the pattern argument

pattern

See list.files

orderChrono

Logical. Should layers in the output object be orderred chronologically. If set to FALSE, layer order will be alphabetical.

...

Arguments to be passed to writeRaster. If specifying a filename, it is strongly recommended to also set a datatype.

Author(s)

Loic Dutrieux

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# 1 - Produce individual VI layers (using processLandsatBatch())
# Get the directory where the Landsat archives are stored
dir <- system.file('external', package='bfastSpatial')

# Set the location of output and intermediary directories (everything in tmpdir in that case)
srdir <- dirout <- file.path(rasterOptions()$tmpdir, 'bfmspatial')
dir.create(dirout, showWarning=FALSE)
processLandsatBatch(x=dir, pattern=glob2rx('*.zip'), outdir=dirout, srdir=srdir, delete=TRUE, vi='ndvi', mask='fmask', keep=0, overwrite=TRUE)

# Visualize one of the layers produced
list <- list.files(dirout, pattern=glob2rx('*.grd'), full.names=TRUE)


# Stack the layers
stackName <- file.path(dirout, 'stack/stackTest.grd')
dir.create(file.path(dirout, 'stack'))
s <- timeStack(x=dirout, pattern=glob2rx('*.grd'), filename=stackName, datatype='INT2S')

plot(s)

dutri001/bfastSpatial documentation built on May 15, 2019, 6:05 p.m.