1. Setup instructions

1.1. Requirements

This toolset is written for use in Linux.

You will need access to a PC or server with at least:

  • Python 3
  • SMFM sen2mosaic <https://github.com/smfm-project/sen2mosaic/>_
  • 8 GB of RAM for classification

Note that processing of large volumes of Sentinel-2 data will require access substantial file storage and processing power. For user over large areas we advice use of a Linux server orsuitably equipped cloud platform.

1.2. Installing Anaconda Python

These tools are written in Python. We recommend the Anaconda distribution of Python, which contains all the modules necessary to run these scripts.

To install Anaconda Python, open a terminal window, change directory to the location you’d like to download Anaconda Python, and run the following commands:

wget https://repo.anaconda.com/archive/Anaconda3-2019.03-Linux-x86_64.sh
chmod +x Anaconda3-2019.03-Linux-x86_64.sh
./Anaconda3-2019.03-Linux-x86_64.sh

If this has functioned, on executing python in a terminal window, you should see the following:

Python 2.7.14 |Anaconda, Inc.| (default, Dec  7 2017, 17:05:42)
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

1.3. Setting up your Anaconda environment

Note

The Anaconda environment required for deforest can also be used for sen2mosaic. This means that sen2mosaic can be installed within the deforest environment without causing problems.

To ensure you are working with the appropriate version of Python as well as the correct modules, we recommend that you create an Anaconda virtual environment set up for running deforest. This is done by running the following commands in your terminal or the Anaconda prompt (recommended procedure):

conda create -n deforest -c conda-forge python=3.7 scipy pandas psutil scikit-image scikit-learn gdal opencv pyshp

Activate the deforest environment whenever opening a new terminal window by running this command:

conda activate deforest

1.4. Installing sen2mosaic

If you’ve not already installed it, sen2mosaic can be downloaded to a machine from its repository . To do this, open a terminal window and input:

git clone https://github.com/smfm-project/sen2mosaic.git

To install sen2mosaic, navigate to the sen2mosaic directory and run the following within your sen2mosaic environment.

python setup.py install

1.5. Installing deforest

Open a terminal window and input:

git clone https://github.com/smfm-project/deforest.git

To install deforest, navigate to the deforest directory and run the following within your deforest environment.

python setup.py install

To avoid having to reference the full path of the Python scripts in deforest, it’s a good idea add the following line to your .bashrc file:

echo "alias deforest='deforest() { python ~/deforest/cli/\"\$1\".py \$(shift; echo \"\$@\") ;}; _deforest'" >> ~/.bashrc

Make sure you replace ~/ with the path to your installation of deforest.

1.6. Where do I get help?

For assistance in setting up and using deforest or sen2mosaic, email sam.bowers@ed.ac.uk.