# NOT RUN {
# load a spatial polygon object of Navarre
data(ex.navarre)
# main output directory
src <- paste0(tempdir(),"/Path_for_downloading_folder")
print(src)
# download Sentinel-2 images
senDownload(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 = src)
# folder with the unzipped images from Sentinel-2
src.sen <- file.path(src,"Sentinel-2")
src.unzip <- file.path(src.sen, "unzip")
# mosaic the Sentinel-2 images
senMosaic(src.unzip,
AppRoot = src.sen,
gutils = TRUE,
out.name = "Navarre")
# path to the folder with the mosaicked images
src2 <- file.path(src.sen, "Navarre")
src3 <- file.path(src.sen, "Navarre_Variables")
dir.create(src3)
# generate EVI images of Navarre
senFolderToVar(src2,
fun = varEVI,
resbands = c("60m"),
AppRoot = src3)
flist <- list.files(file.path(src3,"EVI"),
pattern = "\\.tif$",
full.names = TRUE,
recursive = TRUE)
files.raster <- lapply(flist, raster)
spplot(files.raster[[1]])
# }
Run the code above in your browser using DataLab