Description Usage Arguments Author(s) Examples
Creates a stack of Landsat layers, reordering them chronologically
1 |
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 |
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. |
Loic Dutrieux
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.