| MODIStsp | R Documentation | 
Main function for the MODIS Time Series Processing Tool (MODIStsp)
MODIStsp(
  ...,
  gui = TRUE,
  out_folder = NULL,
  out_folder_mod = NULL,
  opts_file = NULL,
  selprod = NULL,
  prod_version = NULL,
  bandsel = NULL,
  quality_bandsel = NULL,
  indexes_bandsel = NULL,
  sensor = NULL,
  download_server = NULL,
  downloader = NULL,
  user = NULL,
  password = NULL,
  download_range = NULL,
  start_date = NULL,
  end_date = NULL,
  spatmeth = NULL,
  start_x = NULL,
  end_x = NULL,
  start_y = NULL,
  end_y = NULL,
  bbox = NULL,
  spafile = NULL,
  out_projsel = NULL,
  output_proj = NULL,
  out_res_sel = NULL,
  out_res = NULL,
  resampling = NULL,
  reprocess = NULL,
  delete_hdf = NULL,
  nodata_change = NULL,
  scale_val = NULL,
  ts_format = NULL,
  out_format = NULL,
  compress = NULL,
  test = NULL,
  n_retries = 5,
  verbose = TRUE,
  parallel = TRUE
)
| ... | not used for values, forces later arguments to bind by name | 
| gui | 
 | 
| out_folder | 
 | 
| out_folder_mod | 
 | 
| opts_file | 
 | 
| selprod | 
 | 
| prod_version | Version of the selected MODIS product.
Currently versions  | 
| bandsel | 
 | 
| quality_bandsel | 
 | 
| indexes_bandsel | 
 | 
| sensor | 
 | 
| download_server | 
 | 
| downloader | download_server  | 
| user | 
 | 
| password | 
 | 
| download_range | 
 | 
| start_date | 
 | 
| end_date | 
 | 
| spatmeth | 
 | 
| start_x | 
 | 
| end_x | 
 | 
| start_y | 
 | 
| end_y | 
 | 
| bbox | 
 | 
| spafile | 
 | 
| out_projsel | 
 | 
| output_proj | 
 | 
| out_res_sel | 
 | 
| out_res | 
 | 
| resampling | 
 | 
| reprocess | 
 | 
| delete_hdf | 
 | 
| nodata_change | 
 | 
| scale_val | 
 | 
| ts_format | 
 | 
| out_format | 
 | 
| compress | 
 | 
| test | 
 | 
| n_retries | 
 | 
| verbose | 
 | 
| parallel | 
 | 
The function is used to:
initialize the processing (folder names, packages, etc.);
 launch the GUI (MODIStsp_GUI()) on interactive
execution, or load an options file to set processing arguments and/or
retrieve CLI inputs and run processing on non-interactive execution;
 launch the routines for downloading and processing the requested datasets.
(MODIStsp_process())
launching the function with GUI = FALSE and without specifying a opts_file initializes arguments with default values. This allows making a test run.
License: GPL 3.0
Lorenzo Busetto, phD (2014-2017)
Luigi Ranghetti, phD (2015-2017)
MODIStsp_GUI(), MODIStsp_process()
#' # - Running the tool using the GUI
# Running the tool without any option will start the GUI with the default or
# last used settings, in interactive mode (i.e., with gui = TRUE).
if (interactive()) {
  MODIStsp()
}
#' # - Running the tool specifying processing arguments in the call
# **NOTE** Output files of examples are saved to file.path(tempdir(), "MODIStsp").
# Here we process layers __NDVI__ and __EVI__ and quality indicator __usefulness__
# of product __M*D13Q1__, considering both Terra and Aqua platforms, for dates
# comprised between 2020-06-01 and 2020-06-15 and saves output to R tempdir
# --> See name and available layers for product M*D13Q1.
# Note that this example (as well as the following ones) is run in single
# core to follow CRAN policies, by setting parallel = FALSE.
# Users can exploit multicore functionalities skipping to set this argument.
# The following check is performed in order not to provide errors
# running the examples if HDF4 is not supported.
is_hdf4_supported <- "HDF4" %in% sf::st_drivers("raster")$name
MODIStsp_get_prodlayers("M*D13A2")
if (is_hdf4_supported) {
  MODIStsp(
    gui = FALSE,
    out_folder = "$tempdir",
    selprod = "Vegetation_Indexes_16Days_1Km (M*D13A2)",
    bandsel = c("EVI", "NDVI"),
    quality_bandsel = "QA_usef",
    indexes_bandsel = "SR",
    user = "mstp_test" ,
    password = "MSTP_test_01",
    start_date = "2020.06.01",
    end_date = "2020.06.15",
    verbose = FALSE,
    parallel = FALSE
  )
}
#' # - Running the tool using the settings previously saved in a specific options file
# **NOTE** Output files of examples are saved to file.path(tempdir(), "MODIStsp").
# You can run the examples with `gui = TRUE` to set a different output folder!
# Here we use a test json file saved in MODIStsp installation folder which
# downloads and processed 3 MOD13A2 images over the Como Lake (Lombardy, Italy)
# and retrieves NDVI and EVI data, plus the Usefulness Index Quality Indicator.
opts_file <- system.file("testdata/test_MOD13A2.json", package = "MODIStsp")
if (is_hdf4_supported) {
  MODIStsp(gui = FALSE, opts_file = opts_file, verbose = TRUE, parallel = FALSE)
}
# Running the tool using the settings previously saved in a specific option file
# and specifying the extent from a spatial file allows to re-use the same
# processing settings to perform download and reprocessing on a different area
opts_file <- system.file("testdata/test_MOD13A2.json", package = "MODIStsp")
spatial_file <- system.file("testdata/lakeshapes/garda_lake.shp", package = "MODIStsp")
if (is_hdf4_supported) {
  MODIStsp(
    gui = FALSE,
    opts_file = opts_file,
    spatmeth = "file",
    spafile = spatial_file,
    verbose = TRUE,
    parallel = FALSE
  )
}
# Running the tool using the settings previously saved in a
# specific options file and specifying each time the extent from a different
# spatial file (e.g., to perform the same processing on several extents)
# Note that you can also put all your extent files in a specific folder and
# create the extent list using for example.
extent_list = list.files(
  system.file("testdata/lakeshapes/", package = "MODIStsp"),
  "\\.shp$",
  full.names = TRUE
)
extent_list
opts_file <- system.file("testdata/test_MOD13A2.json", package = "MODIStsp")
if (is_hdf4_supported) {
  for (single_shape in extent_list) {
    MODIStsp(
      gui = FALSE,
      opts_file = opts_file,
      spatmeth = "file",
      spafile = single_shape,
      verbose = TRUE,
      parallel = FALSE
    )
  }
}
# output files are placed in separate folders:
outfiles_garda <- list.files(
  file.path(tempdir(), "MODIStsp/garda_lake/VI_16Days_1Km_v61/NDVI"),
  full.names = TRUE
)
outfiles_garda
require(raster)
if (length(outfiles_garda) > 0) {
  plot(raster(outfiles_garda[1] ))
}
outfiles_iseo <- list.files(
  file.path(tempdir(), "MODIStsp/iseo_lake/VI_16Days_1Km_v61/NDVI"),
  full.names = TRUE
)
outfiles_iseo
if (length(outfiles_garda) > 0) {
  plot(raster(outfiles_iseo[1]))
}
# See also https://docs.ropensci.org/MODIStsp/articles/noninteractive_execution.html
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.