preprocS2 is a basic wrapper of the rstac package.
It aims at downloading and preparing Sentinel-2 images for further processings using R packages such as
biodivMapR for spectral diversity mapping,
prosail for the computation of vegetation biophysical variables, and
spinr for the computation of vegetation biophysical variables or spectral indices.
devtools::install_github('jbferet/preprocS2')
preprocS2 uses the STAC API endpoint provided by
MPC.
However, some products optionally required by preprocS2 are not provided by
this STAC API.
This is the case for raster data corresponding to the geometry of acquisition of
Sentinel-2 images.
These products are available from the STAC catalog provided by the Sentinel-hub Catalog API via Copernicus Dataspace.
To be able to download data from the Sentinel-hub STAC Catalog API via
Copernicus Dataspace,
create an account on the CDSE plateform, then add your credentials to your
~/.Renviron.
First, open the ~/.Renviron file for your R install:
usethis::edit_r_environ()Then write your CDSE username, corresponding to your email address, along with the corresponding password:
CDSE_USERNAME = "my_email_address@email.xx"
CDSE_PASSWORD = "My_PaSsW0rD"Finally, activate the OAuth clients following
this link.
Then add your OAuth clients credentials to your ~/.Renviron:
OAUTH_CDSE_ID = "sh-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
OAUTH_CDSE_PWD = "XXXXXXXXXXXXXXXXXXXXXXXXXXXX"Save the ~/.Renviron file and restart your R session. You should then be able
to use all functionalities included in preprocS2.
A tutorial vignette is available here.
This research was supported by the Agence Nationale de la Recherche (ANR, France) through the young researchers project BioCop (ANR-17-CE32-0001)
