Skip to content
Snippets Groups Projects
my_install.md 3.87 KiB
Newer Older
TGermain's avatar
TGermain committed
# Installation

## Prerequisites

This package requires pip3, Python 3, GDAL and Sen2Cor 2.10.01.

Note I: The current version of sen2chain is not available on Windows (yet)

Note II: Installation guide and requirements for previous versions of Sen2Chain and Sen2Cor are available here (_**link to another page of wiki**_). This may be needed to process imagery from 2021 and before.

**<span dir="">GDAL</span>**

```
sudo apt install gdal-bin libgdal-dev python3-gdal
```

**<span dir="">Sen2Cor 2.10.01</span>**

<span dir="">Download Sen2Cor v2.10.01</span> 

```
wget https://step.esa.int/thirdparties/sen2cor/2.10.0/Sen2Cor-02.10.01-Linux64.run
```

Make it executable
```
chmod +x Sen2Cor-02.10.01-Linux64.run
```

Install Sen2Cor 
```
./Sen2Cor-02.10.01-Linux64.run
```
It's possible to add some data to improve some features of sen2chain. These functions are not directly mobilized by sen2chain but for optimal operation you can add ESA landcover data and the SRTM. Please find the process at this page (_**page à faire avec les différentes fonctions de sen2chain**_)

**EODAG**

EODDAG is a command-line tool and a Python package for searching and downloading remotely sensed images while offering a unified API for data access regardless of the data provider. A specific plugin was released for the Scihub provider. Both can be installed with pip.

Install pip first

```
sudo apt install python3-pip
```
Then EODAG

```
python3 -m pip install eodag-sentinelsat
```

## <span dir="">Install sen2chain from sources</span>

Install Git

```
sudo apt-get install git
```
Download Sen2Chain and install the python dependencies

```
git clone https://framagit.org/espace-dev/sen2chain.git 
cd sen2chain
pip3 install --user -e .
```

**Or** install directly from Git:

```
python3 -m pip install git+https://framagit.org/espace-dev/sen2chain.git
```

# <span dir="">Updating sen2chain</span>

<span dir="">Updates are regularly made on the processing chain, it can be easily retrieved with Git. Go to the install directory, pull the last updates from Framagit, and if necessary reinstall Sen2Chain (to get new requirement libraries).</span>

```
cd sen2chain 
git pull 
pip3 install --user -e .
```

# <span dir="">Configuration</span>

<span dir="">The different configuration files are located in ~/sen2chain_data. This files are only created after the first sen2chain import in python. To initialize the config files you can lauch:</span>

```
python3
from sen2chain import Tile
exit()
```

### <span dir="">Configure Sentinel-2 images library</span>

<span dir="">After the first launch of sen2chain, default folders are created in: 

```
~/sen2chain_data/data
```

<span dir="">You can change the settings by editing the configuration file:</span>

```
~/sen2chain_data/data/config.cfg
```
Here you can configure all the paths that will receive the different data from the processing steps of sen2chain. In this file indicate the full path to the bashrc of your sen2cor installation to process L1C to L2A _**(ajouter ici la possibilité de mettre un autre sen2cor pour les données pré 2018)**_:

```
/path/to/Sen2Cor-02.10.01-Linux64/L2A_Bashrc
```

### <span dir="">Hubs logins</span> & EODAG configuration file

Register to Scihub, PEPS and any provider you deem relevant for your work, and get the required credentials (username/password).

Follow the guidelines provided in [EODAG's documentation](https://eodag.readthedocs.io/en/latest/getting_started_guide/configure.html) to configure the plugin. You can create a dedicated configuration file or edit the default one: 

```
~/.config/eodag/eodag.yml
```
Then

```
scihub:
      priority: 1 # Highest number for your preferred provider, see more in eodag documentation 
      api: 
          credentials: 
              username: "PLEASE_CHANGE_ME" # Your own username 
              password: "PLEASE_CHANGE_ME" # Your own password
```

**<span dir="">Sen2Chain is now ready to run!</span>**