getNASA: Find and download NASA products

View source: R/getNASA.R

getNASAR Documentation

Find and download NASA products

Description

Find and download NASA data for a specific product, area, and time period. The function returned is list of filenames that may have been downloaded.

It is important to fist consult getProducts to discover what products and version numbers are available, and which server to use.

Usage

getNASA(product, start_date, end_date, aoi, version=NULL, download=FALSE, path, 
	username, password, server="LPDAAC_ECS", limit=100000, overwrite=FALSE, ...)

Arguments

product

character. Supported products can be found using getProducts

start_date

character. Start date for the data requested formatted yyyy-m-d

end_date

Character. end date for the data requested formatted yyyy-m-d

aoi

numeric vector of four elements (minimum longitude, maximum longitude, minimum latitude, maximum latitude) encompassing the area of interest. It can also be a SpatExtent, or any object from which an extent can be extracted

version

character. product version number

download

logical. If TRUE data will be downloaded unless it is present in the download directory

path

character. Path name indicating where to store the data

username

character. EOSDIS user name (see Details)

password

character. EOSDIS password (see Details)

server

character. The server to download the data from

limit

positive integer

overwrite

logical. If TRUE, existing files are overwritten

...

Additional arguments. These can be product specific. See Details)

Details

This function is an R interface to the EOSDIS system. Access is free, but it requires a "Earthdata" account. If you do not have an account, you can sign up here: https://urs.earthdata.nasa.gov/users/new

If no data is available between start_date and end_date, files for the closest dates are returned.

Value

Character vector of file names pointing to the downloaded files (if download=TRUE)

See Also

getProducts, getLandsat

Examples

  
product <- "MOD09A1"
# information about the product
getProducts(product)
sdate <- "2019-05-17" 
edate <- "2019-05-23"
area <- c(33, 34, -5, -4)
path <- tempdir()
# list available tiles
f <- getNASA(product = product,
            start_date = sdate, end_date = edate,
            aoi = area, download = FALSE, path=path)
f

# get the date from the filenames
modisDate(f)

# to download the tiles, set download = TRUE
# and provide your credentials 

usr <- "your user name"
pwd <- "your password"
#f <- getNASA(product = product, username=urs, password=pwd,
#            start_date = sdate, end_date = edate,
#            aoi = area, download = TRUE, path=path)


rspatial/luna documentation built on Dec. 26, 2024, 12:33 a.m.