Stage a data request, and optionally download the data to disk. Alternatively you can only stage requests, logging the request URLs to submit download queries later on using rs_transfer.

rs_request(
  request,
  user,
  transfer = TRUE,
  path = tempdir(),
  time_out = 3600,
  job_name,
  verbose = TRUE
)

rs_request_batch(
  request_list,
  workers = 2,
  user,
  path = tempdir(),
  time_out = 7200,
  total_timeout = length(request_list) * time_out/workers,
  verbose = TRUE
)

Arguments

request

nested list with query parameters following the layout as specified on the AppEEARS APIs page

user

user (email address or ID) provided by the AppEEARS data service, used to retrieve the token set by rs_set_key

transfer

logical, download data TRUE or FALSE (default = TRUE)

path

path were to store the downloaded data

time_out

individual time out for each request

job_name

optional name to use as an RStudio job and as output variable name. It has to be a syntactically valid name.

verbose

show feedback on processing

request_list

a list of requests that will be processed in parallel.

workers

maximum number of simultaneous request that will be submitted to the service. Most services are limited to ~20 concurrent requests (default = 2).

total_timeout

overall timeout limit for all the requests in seconds. (note that the overall timeout on a session is 48h)

Value

the path of the downloaded (requested file) or the an R6 object with download/transfer information

Author

Koen Hufkens

Examples


if (FALSE) {
# specifiy a task/request as a
# data frame
df <- data.frame(
 task = "grand canyon",
 subtask = c("test1", "test2"),
 latitude = c(36.206228, 36.206228),
 longitude = c(-112.127134, -112.127134),
 start = c("2018-01-01","2018-01-01"),
 end = c("2018-01-15","2018-01-15"),
 product = c("MOD11A2.061","MCD12Q2.006"),
 layer = c("LST_Day_1km","Dormancy")
)

# build a proper JSON query
task <- rs_build_task(df = df)

# request the task to be executed
rs_request(
 request = task,
 user = "earth_data_user",
 transfer = TRUE,
 path = "~/some_path",
 verbose = TRUE
)
}