Comment

The content of this document has no claim to be correct and comes with absolutely no warranty.

Installation

This guide will help you to install the Sentinel Application Platform SNAP on a machine running a Unix bas OS.

1 Unix based OS - Kubuntu

If you already have a Unix based OS set up, skip this section.

When I started using Unix based OS, I tried Kubuntu. It works fine for me, so I never changed my running system. There is no other reason using Kubuntu for me, you might prefer an other distribution.

To prepare and install Kubuntu I assume you have access to a Windows computer with connection to the internet and an USB device with at least 4GB RAM. If you do not have a second machine running Kubuntu, I suggest to use a external SSD (~500GB) via USB 3.0 and install Kubuntu there. If you want to use Kubuntu, boot from this device after setup. Thus, you leave your Windows installation as it is and Kubuntu is separated from your Windows installation.

  • Download Kubuntu ISO
  • Download and run Rufus to create a bootable installation USB-stick
  • Plug the USB device in a computer you want to install Kubuntu on, enter the BIOS and boot from your USB device
  • Follow the Instructions during the Kubuntu installation. Choose to download all drivers, two check marks at the beginning of the installation.
  • After the installation was successful, reboot your machine, update your system (hit the little arrow up icon in the lower right corner and choose update all) and install drivers.
  • In order to do so, click on your application launcher (lower left corner) search for driver and open the Driver Manager, here I choose the recommended NVIDIA driver.

2 Python 2.7

If you just want to use SNAP via its GUI or command line and do not want to use it via the snappy, skip this section.

Because I have a GIS background I am used to work with Python 2.7. I have not tested 3.x but I assume my approach will work for it too. To install Python and spyder I use Anaconda.

Here are the steps I followed for Installation, a short summary:

Go to https://www.anaconda.com/download/#linux and download Anaconda2.

#in terminal
#maybe you have to change the version number
bash ~/Downloads/Anaconda2-5.1.0-Linux-x86_64.sh
#agree the license terms 
#choose an installation folder
#add anaconda installation to PATH environment

3 SNAP Toolbox

Go to http://step.esa.int/main/download/ and download Sentinel Toolboxes Unix 64-bit or 32-bit depending on your machine.

#in terminal
#navigate to the Download directory
cd Downloads
#do not use sudo for installation
#maybe you have to change the version number
chmod +x esa-snap_sentinel_unix_6_0.sh
./esa-snap_sentinel_unix_6_0.sh

Follow the instructions and do not configure python during the installation. You can do that, but we will do it in the next step manually. Run SNAP and update the program, lower right corner, green check mark symbol. If you get an error message telling you the WWWorld Viewer can not be launched you probably missed to install your graphic drivers. Go to the application launcher in Kubuntu search for drivers and open the Driver Manager, install the needed drivers for your system.

Close SNAP.

4 Configure snappy SNAP - Python interface

If you just want to use SNAP via its GUI or command line and do not want to use it via the snappy, skip this section. If you do want to use snappy, you have to install Python first

In 5.x I faced some trouble doing this, since the 6.0 release it works fine again. Before starting the configuration, install jpy a Java - Python interface, hence SNAP is written in Java.

sudo apt-get update
sudo apt-get install python-jpy

I configured snappy by following these guide

It tells you to do:

#in terminal
cd <snap-install-dir>/bin
./snappy-conf /home/<user>/anaconda2/bin/python

If it works, go to /home/<user>/.snap/snap-python/ and copy the snappy folder to the site-package folder of your python installation /home/<user>/anaconda2/lib/python2.7/site-packages/

cp -r /home/user/.snap/snap-python/snappy /home/user/anaconda2/lib/python2.7/site-packages

To test if all is right, call spyder:

spyder

and run this python script, use F9 to run selected lines or the line your courser is in, when using spyder.

from snappy import ProductIO
p = ProductIO.readProduct('/home/user/.snap/snap-python/snappy/testdata/MER_FRS_L1B_SUBSET.dim')
list(p.getBandNames())

your output should look like this:

[‘radiance_1’, ‘radiance_2’, ‘radiance_3’, ‘radiance_4’, ‘radiance_5’, ‘radiance_6’, ‘radiance_7’, ‘radiance_8’, ‘radiance_9’, ‘radiance_10’, ‘radiance_11’, ‘radiance_12’, ‘radiance_13’, ‘radiance_14’, ‘radiance_15’, ‘l1_flags’, ‘detector_index’]

If the configuration returns an error, I followed the hints found in the Step Forum by marpet on the 19th of September in this thread.

Copy the snappy folder /home/<user>/.snap/snap-python/snappy/ to the site-package folder of your python installation /home/<user>/anaconda2/lib/python2.7/site-packages/.

cp -r /home/user/.snap/snap-python/snappy /home/user/anaconda2/lib/python2.7/site-packages

I think the snappy folder you have just copied, was created when you tried to configure snappy and it ended with an error, therefore the snappy.ini file in the folder is empty by now. Enter the copied folder and create or overwrite a file named snappy.ini with a text editor including this content:

[DEFAULT]
snap_home = /home/<user>/snap
java_max_mem: 21G
# the java_max_mem value should be 70-80% of your overall RAM
# snap_start_engine: False
# java_class_path: ./target/classes
# java_library_path: ./lib
# java_options: -Djava.awt.headless=false
# debug: False

To test if all is right,

#in terminal
spyder

and run this script within spyder

from snappy import ProductIO
p = ProductIO.readProduct('/home/user/.snap/snap-python/snappy/testdata/MER_FRS_L1B_SUBSET.dim')
list(p.getBandNames())

your output should look like this:

[‘radiance_1’, ‘radiance_2’, ‘radiance_3’, ‘radiance_4’, ‘radiance_5’, ‘radiance_6’, ‘radiance_7’, ‘radiance_8’, ‘radiance_9’, ‘radiance_10’, ‘radiance_11’, ‘radiance_12’, ‘radiance_13’, ‘radiance_14’, ‘radiance_15’, ‘l1_flags’, ‘detector_index’]

5 sentinelsat

This step is optional, but the tool is very helpful when downloading Sentinel images.

This is a python module which allows you to enter esa’s Copernicus Open Access Hub very comfortable to download remote sensing data. Have a look here. You need to have an account, which is free!

sudo apt-get install python-pip 
pip install sentinelsat