Instruction are provided separately for each OS:
The support for MacOS will be added in future.
Alternatively, sen2r can be used in a Docker container.
Before installing sen2r, it is recommended to check R (v. 3.4.4 or higher) and the following libraries to be present:
Other binaries are required (or suggested), since they are used in runtime by the package:
To install both package dependencies and runtime binaries (excepting sen2cor, which is installed by sen2r):
On Debian and Ubuntu:
sudo apt-get install -y r-base gdal-bin python-gdal aria2 libpython-dev libudunits2-dev libgdal-dev libjq-dev libprotobuf-dev protobuf-compiler libv8-dev libssl-dev libcairo2-dev
On Debian, proj-epsg
is also required:
sudo apt-get install -y proj-epsg
On Ubuntu 16.04 LTS Xenial and 14.04 LTS Trusty, the repositories ubuntugis and opencpu must be added before installing the packages:
sudo add-apt-repository -y ppa:opencpu/jq
sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update -q
On Fedora:
sudo yum install R gdal gdal-python aria2 python-devels gdal-devel proj-devel geos-devel udunits2-devel jq-devel protobuf-devel v8-devel openssl-devel cairo-devel libcurl-devel netcdf-devel libxml2-devel
On ArchLinux:
sudo pacman -S --noconfirm r base-devel gcc-fortran python-gdal wget aria2 jq protobuf git
cd /tmp; git clone https://aur.archlinux.org/gyp-git.git
cd gyp-git; makepkg -si --noconfirm
cd /tmp; git clone https://aur.archlinux.org/v8-3.14.git
cd v8-3.14; makepkg -si --noconfirm
cd /tmp; git clone https://aur.archlinux.org/udunits.git
cd udunits; makepkg -si --noconfirm
Installation was tested on date 2018-11-21.
Before proceeding, it is suggested to update the existing R packages:
update.packages(ask = FALSE)
Doing that, the following warning could appear:
Warning in install.packages(update[instlib == l, "Package"], l, contriburl = contriburl, :
'lib = "/usr/lib/R/library"' is not writable
Would you like to use a personal library instead? (y/n)
If so, press y
and continue. Moreover, if no personal libraries already exist, it is asked to create a new one: ask y
and continue.
After that, the package can be installed from GitHub with the R package remotes. To do it:
install the package remotes, if missing:
install.packages("remotes")
load it and install sen2r:
library(remotes)
install_github("ranghetti/sen2r")
This will install the R package along with its package dependencies, containing all the functions necessary to preprocess data.
Finally, sen2cor can be installed from R:
library(sen2r)
install_sen2cor()
R must be installed before proceeding.
In the case it was already installed, it is suggested to update the existing R packages:
update.packages(ask = FALSE)
sen2r can be installed from GitHub with the R package remotes. To do it:
install the package remotes, if missing:
install.packages("remotes")
load it and install sen2r:
library(remotes)
install_github("ranghetti/sen2r")
This will install the R package along with its package dependencies, containing all the functions necessary to preprocess data.
To run the functions correctly, some external dependences are required:
These dependences can be graphically checked launching the function
library(sen2r)
check_sen2r_deps()
This function opens a GUI which help to check that they are satisfied; if some of them are missing, the GUI allows to install them directly.