Skip to content
R toolbox to search, download and preprocess Sentinel-2 data
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.Rproj.user/842EF193 Empty package structure Jul 20, 2017
R
WIP
docs Update documentation May 13, 2019
inst Fix codecov May 13, 2019
man
vignettes Two fixes (#180) May 2, 2019
.Rbuildignore WIP Aug 23, 2017
.gitignore Implement downloading SAFE with aria2 (#34) Apr 20, 2018
.travis.yml new s2_calcindices() algorythm (#162) Mar 19, 2019
CONDUCT.md
DESCRIPTION Update to version 1.0.2 (#182) May 8, 2019
Dockerfile
LICENSE Empty package structure Jul 20, 2017
NAMESPACE Devel (#181) May 8, 2019
README.Rmd
README.md Fix codecov May 13, 2019
_pkgdown.yaml RC v1.0.0 (#148) Feb 11, 2019
index.Rmd
index.md Update documentation May 13, 2019

README.md

Travis-CI Build Status Docker Automated build DOI CRAN Status License: GPL v3 Contributor Covenant

R toolbox to find, download and preprocess Sentinel-2 data

sen2r is an R library which helps to download and preprocess Sentinel-2 optical images. The purpose of the functions contained in the library is to provide the instruments required to easily perform (and eventually automate) all the steps necessary to build a complete Sentinel-2 processing chain, without the need of any manual intervention nor the needing to manually integrate any external tool.

In particular, sen2r allows to:

  • retrieve the list of available products on a selected area (which can be provided by specifying a bounding box, by loading a vector file or by drawing it on a map) in a given time window;
  • download the required SAFE Level-1C products, or retrieve the required SAFE Level-2A products by downloading them (if available) or downloading the corresponding Level-1C and correcting them with Sen2Cor;
  • obtain the required products (Top of Atmosphere radiances, Bottom of Atmosphere reflectances, Surface Classification Maps, True Colour Images) clipped on the specified area (adjacent tiles belonging to the same frame are merged);
  • mask cloudy pixels (using the Surface Classification Map as masking layer);
  • computing spectral indices and RGB images.

Setting the execution of this processing chain is particularly easy using the sen2r GUI, which allows to set the parameters, to directly launch the main function or to save them in a JSON file which can be used to launch the processing at a later stage.

The possibility to launch the processing with a set of parameters saved in a JSON file (or directly passed as function arguments) makes easy to build scripts to automatically update an archive of Sentinel-2 products. Specific processing operations (i.e. applying Sen2Cor on Level-1c SAFE products, merging adjacent tiles, computing spectral indices from existing products) can also be performed using intermediate functions (see usage).

Installation

sen2r is supported over Linux and Windows operating systems; the support for Mac will be added in future.

Install locally

The package can be installed from GitHub with the R package remotes:

remotes::install_github("ranghetti/sen2r")

For detailed instructions about installing the package (including dependencies), see the Installation page.

Run as Docker image

A dockerised version of sen2r is available here.

For detailed instructions about using it, see the page "Run in a Docker container" page.

Usage

The simplest way to use sen2r is to execute it in interactive mode:

library(sen2r)
sen2r()

this opens a GUI which allows to set the required processing parameters, and then launches the main function.


Alternatively, [`sen2r()`](http://sen2r.ranghetti.info/reference/sen2r.html) can be launched with a list of parameters (created with [`s2_gui()`](http://sen2r.ranghetti.info/reference/s2_gui.html)) or passing manually the parameters as arguments of the function (see [the documentation of the function](http://sen2r.ranghetti.info/reference/sen2r.html) for further details).

Other specific functions can be used to run single steps separately:

  • s2_list() to retrieve the list of available Sentinel-2 products basing on input parameters;
  • s2_download() to download Sentinel-2 products;
  • sen2cor() to correct level-1C products using Sen2Cor;
  • s2_translate() to convert Sentinel-2 products from SAFE format to a format managed by GDAL;
  • s2_merge() to merge Sentinel-2 tiles which have the same date and orbit;
  • gdal_warp() to clip, reproject and warp raster files (this is a wrapper to call gdal_translate or gdalwarp basing on input parameters);
  • s2_mask() to apply a cloud mask to Sentinel-2 products;
  • s2_rgb() to generate RGB images from Sentinel-2 Surface Reflectance multiband raster files;
  • s2_calcindices() to compute maps of spectral indices from Sentinel-2 Surface Reflectance multiband raster files;
  • s2_thumbnails() to generate RGB thumbnails (JPEG or PNG) of the products.

Credits

sen2r is being developed by Luigi Ranghetti and Lorenzo Busetto (IREA-CNR), and it is released under the GNU General Public License version 3 (GPL‑3).

The sen2r logo, partially derived from the R logo, is released under the Creative Commons Attribution-ShareAlike 4.0 International license (CC-BY-SA 4.0).

The functionalities to search and download SAFE tiles are based on the Python tool Sentinel-download by Olivier Hagolle, released under the GNU General Public License version 2 (GPL‑2).

To cite this library, please use the following entry:

Ranghetti, L. and Busetto, L. (2019). sen2r: an R toolbox to find, download and preprocess Sentinel-2 data. R package version 1.0.2. DOI: 10.5281/zenodo.1240384. URL: http://sen2r.ranghetti.info.

@Manual{sen2r,
  title  = {sen2r: an R toolbox to find, download and preprocess Sentinel-2 data},
  author = {Luigi Ranghetti and Lorenzo Busetto},
  year   = {2019},
  note   = {R package version 1.0.2},
  doi    = {10.5281/zenodo.1240384},
  url    = {http://sen2r.ranghetti.info},
}

Contributing

This project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Users are encouraged to use GitHub issues in case of errors with the package. Before opening a new issue, please read these notes.

You can’t perform that action at this time.