Learn R Programming

getSpatialData (version 0.0.4)

getMODIS_data: Download MODIS data

Description

getMODIS_data downloads MODIS data queried using getMODIS_query from different sources.

Usage

getMODIS_data(records, dir_out = NULL, force = FALSE, verbose = TRUE)

Arguments

records

data.frame, one or multiple records (each represented by one row), as it is returned by getMODIS_query.

dir_out

character, full path to download target directory. Optional. If not set, getMODIS_data uses the directory to the getSpatialData archive folder. Use set_archive to once define a getSpatialData archive folder.

force

logical. If TRUE, download is forced even if file already exisits in the download directory. Default is FALSE.

verbose

logical, whether to display details on the function's progress or output on the console.

Value

Character vector of paths to the downloaded files.

Details

getMODIS_data downloads MODIS data from the Level-1 and Atmosphere Archive & Distribution System (LAADS) of NASA's Distributed Active Archive Center (DAAC) at the Goddard Space Flight Center in Greenbelt, Maryland (https://ladsweb.modaps.eosdis.nasa.gov/).

See Also

getMODIS_names getMODIS_query getMODIS_preview

Examples

Run this code
# NOT RUN {
## Load packages
library(getSpatialData)
library(sf)

## set aoi and time range for the query
set_aoi(aoi_data[[1]])
time_range <-  c("2017-08-01", "2017-08-30")

## Login to USGS ERS
# }
# NOT RUN {
login_USGS("username")

## set archive directory
set_archive("/path/to/archive/")

## get available products and select one
product_names <- getMODIS_names()
product <- grep("MOD13Q1", product_names, value = T)

## query for records for your AOI, time range and product
query <- getMODIS_query(time_range = time_range, name = product)

## preview a record
getMODIS_preview(query[1,])

## download records 1 and 2
files <- getMODIS_data(query[1:2,])
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab