calc.indices {climodr} | R Documentation |
Calculate spectral indices
Description
Calculates a set of spectral indices to have more predictor variables available when further modeling.
Usage
calc.indices(
envrmt = .GlobalEnv$envrmt,
vi = "all",
bands = c("blue", "green", "red", "nir", "nirb", "re1", "re2", "re3", "swir1", "swir2"),
overwrite = FALSE
)
Arguments
envrmt |
variable name of your envrmt list created using climodr's 'envi.create' function. Default = envrmt. |
vi |
Character. Either "all" or vector containing the preferred spectral indices. See 'Details' for more information. |
bands |
Character. Vector with lenght(bands) = 10. Contains the names of the bands in the Raster Stack. If bands from the *Usage* example vector dont exist, use "NA" in their position. See 'Details' for more information. |
overwrite |
logical. Argument passed down from 'terra'-package. Overwrite existing files? |
Value
SpatRaster-Stack
See Also
'crop.all', 'fin.csv'
Examples
#create climodr environment and allow terra-functions to use 70% of RAM
envrmt <- envi.create(proj_path = tempdir(),
memfrac = 0.7)
# Load the climodr example data into the current climodr environment
clim.sample(envrmt = envrmt)
# Crop all raster bands
crop.all(envrmt = envrmt,
method = "MB_Timeseries",
overwrite = TRUE)
# Calculate Indices from cropped raster bands
calc.indices(envrmt = envrmt,
vi = "all",
bands = c("blue", "green", "red",
"nir", "nirb",
"re1", "re2", "re3",
"swir1", "swir2"),
overwrite = TRUE)
[Package climodr version 1.0.0 Index]