New article published by "Computers & Geosciences": the R package "sen2r"


sen2r is an R package developed by the Institute of Remote Sensing of Environment (IREA) of the Italian National Research Council, with the aim to simplify and speed up several steps commonly needed to process Sentinel-2 data. Recently, an important recognition to the worth and usefulness of this tool came from the ISI journal Computers & Geosciences, publishing the scientific paper “sen2r”: An R toolbox for automatically downloading and preprocessing Sentinel-2 satellite data.

Up to the 14th of May 2020, it is possible to get free access to the manuscript at this link:

sen2r flowchart
Fig. 1: flowchart of thesen2r processing chain described in the manuscript.

The paper provides an overview of the functionalities of the package, including the description of a use case in the framework of a Service-Oriented Architecture.

First, the steps performed by a standard processing chain (Fig. 1) are described:

  1. search the available Sentinel-2 products over an area of interest and in a specific time window;
  2. download the required Level 1C (Top-Of-Atmosphere reflectances) or Level 2A (Bottom-Of-Atmosphere surface reflectances) SAFE data, or order them from the Long Term Archive;
  3. run the Sen2Cor algorithm on Level 1C images to perform the atmospheric correction;
  4. crop downloaded products over a specific area of intesest (merging adjacent tiles belonging to the same frame if needed);
  5. run the required geometric transformations (e.g. reprojection, reshape);
  6. mask pixels classified as cloudy;
  7. compute the desired spectral indices;
  8. create customised RGB colour images from the reflectance raster stacks and save JPEG thumbnails for all products.

Next section describes the Graphical User Interface (GUI) which can be used to easily set processing parameters (Fig. 2). This tool is particularly indicated for end-users with limited R programming skills: indeed, it is sufficient to launch the command sen2r() to open the GUI, set the desired parameters (eventually exporting them in a JSON file for a subsequent use) and run the processing chain. Skilled R users can exploit the package command-line functionalities described in the paper, by specifying sen2r() function arguments or using additional functions to run specific processing steps or accessory utilities (some reproducible code chunks are included in the paper as examples). Moreover, it is possible to schedule the execution of a processing chain, so to keep a product archive updated in near-real time.

The paper also describes how the user can exploit his own PC features through parallel computation over CPU cores, comparing the performances obtained by three different machines (a desktop PC, a workstation and a cloud-based infrastructure) on an example processing chain.

sen2r gui
Fig. 2: sen2r GUI sheets.

Last section of the manuscript shows a real sen2r use case as Service-Oriented Architecture backend, implemented in the framework of the SATURNO project in which IREA was involved, devoted to demonstrate a precision farming service infrastructure. This example illustrates how the package can be used to provide added value information to end-users, by defining and scheduling a custom processing chain. In this specific case, geo-spatial products based on sen2r automatic image processing were used by Italian farmers to perform variable rate tecnology fertilisation. Vegetation indices were produced from Sentinel-2 data to identify plant status spatial heterogeneihy (prescription maps) and crop growth temporal variability (best suitable time windows for fertilisations).

sen2r is released with license GNU GPL-3, so it can be freely accessed and modified by users. The complete reference to the article, here reported, is to be used in scientific works that exploit the package.

L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). “sen2r: An R toolbox for automatically downloading and preprocessing Sentinel-2 satellite data”. Computers & Geosciences, 139, 104473. DOI: 10.1016/j.cageo.2020.104473, URL:

Luigi Ranghetti
Spatial data analyst

My interests include spatial data processing, remote sensing analysis, R programming.