knitr::opts_chunk$set( collapse = TRUE, comment = "#>", eval = TRUE, fig.width = 7, fig.height = 7 )
library(AIgeomorphologist) library(sen2r) library(progress)
We define here the parameters corresponding to the parameters used for retrieving and downloading the SAFE tiles in this vignette.
labelled_points <- SSCT_data %>% to_spatial() %>% sf::st_as_sf() cloud_threshold <- 5.6 time_interval <- c(as.Date("2019-06-01"), as.Date("2020-10-01")) time_period <- "full" level <- "L2A" availability <- "online" .radius <- 1000 # m
# Set paths out_dir <- "G:/S2_data/sen2r_output/" # output folder safe_dir <- "G:/S2_data/SAFE/" # folder to store downloaded SAFE pb <- progress_bar$new(format = "[:bar] :current/:total - :percent in :elapsed/:eta \n", total = nrow(labelled_points), show_after = 0) invisible(pb$tick(0)) for (n in seq(nrow(labelled_points))){ current_point <- labelled_points[n, ] .out_dir <- file.path(out_dir, as.character(current_point$SiteID)) if(!dir.exists(.out_dir)) dir.create(.out_dir) paths <- sen2r( gui = FALSE, timewindow = time_interval, timeperiod = time_period, online = (availability == "online"), step_atmcorr = tolower(level), max_cloud_safe = cloud_threshold, list_prods = c("BOA","SCL"), list_rgb = c("RGB432B"), list_indices = c("NDVI"), extent = current_point %>% point_to_geojson_polygon(radius = .radius), path_l1c = safe_dir, path_l2a = safe_dir, path_out = .out_dir, order_lta = FALSE, clip_on_extent = TRUE, processing_order = "mixed", thumbnails = FALSE, parallel = 4, preprocess = TRUE ) pb$tick() gc() }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.