senDownSearch: Search and download Sentinel images

Description Usage Arguments Details Value Examples

View source: R/senDownSearch.R

Description

senDownSearch searches and downloads Sentinel images concerning a particular location and time interval from ‘SciHub’s' repository.

Usage

1
senDownSearch(username, password, AppRoot, verbose = FALSE, ...)

Arguments

username

ESA’s ‘SciHub’ username.

password

ESA’s ‘SciHub’ password.

AppRoot

the directory where the images are saved.

verbose

logical argument. If TRUE, the function prints the running steps and warnings.

...

arguments for nested functions:

  • product the type of Sentinel product. Ex. "S2MSI1C", "S2MSI2A", "S2MSI2Ap", ...

  • startDate a Date class object with the starting date of the study period. This argument is mandatory if dates is not defined.

  • endDate a Date class object with the ending date of the study period. This argument is mandatory if dates is not defined.

  • dates a vector with the capturing dates being considered for searching. This argument is mandatory if startDate and endDate are not defined.

  • region a Spatial*, projected raster*, or sf class object defining the area of interest.

  • extent an extent, Raster*, or Spatial* object representing the region of interest with longitude/latitude coordinates. This argument is mandatroy when region is not defined.

  • platform the name of the Sentinel mission ("Sentinel-1", "Sentinel-2", ...).

  • nattempts the number of attempts to download an image in case it becomes corrupted.

  • unzip logical argument. If TRUE, unzips the images.

  • verbose logical argument. If TRUE, the function prints the running steps and warnings.

Details

senDownSearch is a wrapper function of senSearch and senDownload to search and download images in a single step. The function requires ESA’s ‘SciHub’ credentials, which can be obtained here.

Value

this function does not return anything. It saves the imagery as 'zip’ (and JP2 files) in a folder called 'raw’ ('unzip’) in the AppRoot directory.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## Not run: 
# load a spatial polygon object of Navarre
data(ex.navarre)
# Download S2MSI1C products sensed by Sentinel-2 
# between the julian dates 210 and 218, 2018
wdir <- file.path(tempdir(),"Path_for_downloading_folder")
print(wdir)
senDownSearch(startDate = as.Date("2018210", "%Y%j"),
            endDate = as.Date("2018218", "%Y%j"),
            platform = "Sentinel-2",
            extent = ex.navarre,
            product = "S2MSI1C",
            pathrow = c("R094"),
            username = "username",
            password = "password",
            AppRoot = wdir)
            
wdir.sen <- file.path(wdir, "Sentinel-2")
wdir.sen.unzip <- file.path(wdir.sen, "unzip")
                  
files.sen.unzip <- list.files(wdir.sen.unzip,
                              pattern = "\\TCI.jp2$",
                              full.names = TRUE,
                              recursive = TRUE)
img.sen.rgb <- stack(files.sen.unzip[1])
plotRGB(img.sen.rgb)

## End(Not run)

RGISTools documentation built on July 2, 2020, 3:58 a.m.