MODIStsp_addindex: Add custom spectral indexes

View source: R/MODIStsp_addindex.R

MODIStsp_addindexR Documentation

Add custom spectral indexes

Description

Function used to add a user-defined Spectral Index to the default list of computable spectral indexes. Execution without the GUI (i.e., to add a new index from a script) is also possible (see examples).

Usage

MODIStsp_addindex(
  new_indexbandname = "",
  new_indexfullname = "",
  new_indexformula = "",
  new_indexnodata_out = "32767"
)

Arguments

new_indexbandname

character short name (acronym) of the new spectral index (Ignored if gui == TRUE), Default: NULL

new_indexfullname

character extended name (acronym) of the new spectral index (Ignored if gui == TRUE), Default: NULL

new_indexformula

character string containing the formula of the new spectral indexes (Ignored if gui == TRUE). Variables allowed in the formula are the names of the bands: b1_Red, b2_NIR, b3_Blue, b4_Green, b5_SWIR, b6_SWIR and b7_SWIR. Default: NULL

new_indexnodata_out

character nodata value to use for rasters containing the new index

Details

  • The function asks the user to provide the info related to the new desired Spectral Index, checks for correctness of provided information (e.g., correct bandnames, computable formula, etc...). If the index is legit, it modifies the MODIStsp_addindex.json file so to allow computation of the additional index within MODIStsp for all products containing the required reflectance bands.

  • To remove all custom-added spectral indexes, run MODIStsp_resetindexes()

Value

The function is called for its side effects. On success, the MODIStsp_indexes.json is modified so to allow computation of the additional indexes.

Note

License: GPL 3.0

Author(s)

Lorenzo Busetto, phD (2014-2017)

Luigi Ranghetti, phD (2015) luigi@ranghetti.info

See Also

MODIStsp_resetindexes

Examples

# Run the GUI to interactively define a new index
 ## Not run: 
 MODIStsp_addindex()
## End(Not run)

# Define the new index in non-interactive execution

## Not run: 
MODIStsp_addindex(new_indexbandname = "SSI",
  new_indexfullname = "Simple Useless Index",
  new_indexformula = "b2_NIR+b1_Red")

## End(Not run)

MODIStsp documentation built on Aug. 27, 2022, 1:05 a.m.