load_s2paths | R Documentation |
Load the paths of rasters included in a Sentinel-2 archive
generated with {sen2r}
, filtering relevant files and ordering them.
Output can also be returned in format stars
or stars_proxy
(see argument out_format
).
load_s2paths(
inpath,
out_format = "path",
prod_type,
time_window,
s2_orbits,
s2_sensors,
file_ext,
bbox,
.use_vrt = FALSE
)
inpath |
Path of the directory in which |
out_format |
(optional) Output format, being one among
|
prod_type |
(optional) |
time_window |
(optional) time window to import
(used for filtering among |
s2_orbits |
(optional) Sentinel-2 orbits to import
(used for filtering among |
s2_sensors |
(optional) Sentinel-2 sensor to import ( |
file_ext |
(optional) input file extension
(used for filtering among |
bbox |
(optional) object of class |
.use_vrt |
(optional) pass through a temporary VRT before creating |
The output raster cube in the selected format.
Luigi Ranghetti, PhD (2020) luigi@ranghetti.info
# Path of a sample archive created with sen2r (see ?sample_paths)
archive_dir <- system.file("extdata/sen2r/sampleroi", package = "sen2rts")
# Default function behaviour
sen2r_ndvi_paths <- load_s2paths(file.path(archive_dir, "NDVI"))
gsub(archive_dir, "", head(sen2r_ndvi_paths))
# Specifying argument prod_type, the parent directory can also be provided:
sen2r_scl_paths <- load_s2paths(archive_dir, prod_type = "SCL")
gsub(archive_dir, "", head(sen2r_scl_paths))
# Filter on dates and return a stars raster cube
sen2r_ndvi_cube <- load_s2paths(
archive_dir, prod_type = "NDVI",
time_window = c("2020-05-20", "2020-06-05"),
out_format = "stars"
)
plot(sen2r_ndvi_cube)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.