Description Usage Arguments Value Author(s) See Also Examples
Processes a single Landsat scene, from tarball or zip archive (or hdf/tiff if untar is set to FALSE) to vegetation index. Easy to batch using sapply or mclapply for parallel implementation. Data obtained from espi may already contained pre-processed indices layers, in which case they are directly used.
1 2 |
x |
Character. filename of the tarball or zip archive of the hdf/tiff file. |
vi |
Character. Vegetation index to be computed or extracted from the archive. Can be either 'ndvi', 'evi', 'savi', 'ndmi'*, 'nbr', 'nbr2'* or 'msavi'*. Indices with * need to be present in the archive. Note that it is also possible to extract single bands using the |
srdir |
Character. Directory where the tarball should be uncompressed. Can be ommited if |
outdir |
Character. Directory where the vegetation index rasterLayer should be written. |
untar |
Logical. Is there a need to untar data, or have they been previously unpacked. |
delete |
Logical. Should surface reflectance files (hdf/tiff) be deleted after vegetation index calculated? (usefull for disk space management; surface reflectance files are very voluminous and a user may want to keep the Landsat archive in compressed format only) |
mask |
Character or NULL. The name of the mask to be applied to the bands (e.g.: |
L |
Numeric. Soil-adjustment factor for SAVI (ignored if vi != 'savi'). L can take on values between 0 and 1, and a default of 0.5 is typically used. |
... |
Arguments to be passed to sr2vi. Do not specify |
rasterLayer Object also written to file (in outdir
) with an automatically generated filename
Loic Dutrieux
sr2vi
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Get list of test data files
dir <- system.file('external', package='bfastSpatial')
list <- list.files(dir, full.names=TRUE)
# 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)
# Generate (or extract, depending on whether the layer is already in the archive or not) NDVI for the first archive file
processLandsat(x=list[1], vi='ndvi', outdir=dirout, srdir=srdir, delete=TRUE, mask='fmask', keep=0, overwrite=TRUE)
# Visualize one of the layers produced
list <- list.files(dirout, pattern=glob2rx('*.grd'), full.names=TRUE)
plot(r <- raster(list[1]))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.