prepSentinel makes downloaded Sentinel datasets ready-to-use by automatically inspecting, extracting, sorting and converting the relevant contents of the datasets to a user-defined format.

prepSentinel(datasets, dir_out = NULL, format = "vrt",
  select.tiles = "all", overwrite = F, verbose = T)

Arguments

datasets

character vector or list, containing paths to datasets (.zip, as downloaded by getSentinel_data) that should be prepared.

dir_out

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

format

character, output format of the raster datasets (indicated by the file extension, e.g. "tiff" for format GTiff). Default is "vrt".

select.tiles

character, selecting one or multuple specific tiles to prepare. Older datasets archived by ESA contain multiple tiles. If select.tiles is set to one or multiple specific tiles contained within the selected datasets (e.g. "T32TNT"), only these tiles will be extracted and prepared. By default, all tiles are extracted and prepared. Ignored for datasets that contain only a single tile.

overwrite

logical, whether to overwrite existing files or not.

verbose

logical, if TRUE, details on the function's progress will be visibile on the console. Default is TRUE.

Value

Character vector of paths to the prepared files.

See also

Examples

## Load packages library(getSpatialData) library(sf) library(sp) ## Define an AOI (either matrix, sf or sp object) data("aoi_data") # example aoi aoi <- aoi_data[[3]] # AOI as matrix object, or better: aoi <- aoi_data[[2]] # AOI as sp object, or: aoi <- aoi_data[[1]] # AOI as sf object ## set AOI for this session set_aoi(aoi) view_aoi() #view AOI in viewer # or, simply call set_aoi() without argument to interactively draw an AOI ## Define time range and platform time_range <- c("2017-08-01", "2017-08-30") platform <- "Sentinel-2" ## set login credentials and an archive directory
# NOT RUN { login_CopHub(username = "username") #asks for password or define 'password' set_archive("/path/to/archive/") ## Use getSentinel_query to search for data (using the session AOI) records <- getSentinel_query(time_range = time_range, platform = platform) ## Get an overview of the records View(records) #get an overview about the search records colnames(records) #see all available filter attributes unique(records$processinglevel) #use one of the, e.g. to see available processing levels ## Filter the records records_filtered <- records[which(records$processinglevel == "Level-1C"),] #filter by Level ## Preview a single record getSentinel_preview(record = records_filtered[5,]) ## Download some datasets datasets <- getSentinel_data(records = records_filtered[c(4,5,6),]) ## Make them ready to use datasets_prep <- prepSentinel(datasets, format = "tiff") ## Load them to R r <- stack(datasets_prep[[1]][[1]][1]) #first dataset, first tile, 10m resoultion # }