if (FALSE) {
# Remove all custom-defined spectral indexes from an options file
# Add a custom index for testing purposes
library(jsonlite)
opts_jsfile = system.file("testdata/test_addindex.json",
package = "MODIStsp")
MODIStsp_addindex(
opts_jsfile = opts_jsfile,
gui = FALSE,
new_indexbandname = paste0("Index_", as.character(sample(10000, 1))),
new_indexformula = "b1_Red - b2_NIR",
new_indexfullname = paste0("Index_", as.character(sample(10000, 1)))
)
opts <- jsonlite::fromJSON(indexes_file)
opts$custom_indexes[1]
# Now remove all custom indexes
MODIStsp_resetindexes()
opts <- jsonlite::fromJSON(opts_jsfile)
opts$custom_indexes[1]
}
Run the code above in your browser using DataLab