maximlamare / S3_extract

Extract the outputs from the S3 OLCI processor for a given number of S3 files at given coordinates.
MIT License
1 stars 2 forks source link

S3_extract

Code style: black

Current S3Snow processor version: 2.3

The repository contains 3 tools:

The work requires SNAP 7 and the following experimental SNAP plugins:

Code developed within the Sentinel-3 for Science, Land Study 1: Snow project led by Jason Box. More information at snow.geus.dk.

Development and testing: Maxim Lamare, Jason Box, and Jonas Kvist Andersen.

Content

  1. Introduction
  2. Requirements and setup
  3. Workflow

Introduction

The s3_extract_snow_products script, developed by the S34Sci Land Study 1: Snow, extracts the outputs of the S3Snow algorithm results for a list of S3 OLCI L1C scenes for a user-supplied list of latitude and longitude coordinates.

Requirements and setup

The processing of the S3 images is performed with snappy: the SNAP Java API from Python. The installation of the libraries is detailed below. The use of Anaconda is strongly recommended to run the scripts provided in this repository, and the installation steps provided assume the use of a Conda environment.

Note: there are 2 branches on this repository:

  1. the master branch, designed for Mac OS
  2. a Linux branch

There is currently no Windows OS support.

Setup steps:

  1. You can get Anaconda or Miniconda here
  2. The current version of the script was designed to work with Python 3.4 or 3.5.
  3. Install SNAP 7 and the S3Snow plugins (listed below). The S34Sci Snow SUM describes the plugins.
  4. Install or verify that JDK is installed on your system and JDK_HOME path is set.
  5. Create a Conda environment (see steps below) and configure snappy to work with the environment's Python interpreter (the hardest part). The instructions are found here.

For MacOS users @mankoff created an installation guide (essentially the same for Linux or Windows systems):

# create conda environement
conda create -n SNAP python=3.4
source activate SNAP

# install pandas
conda install pandas

# install jpy
cd /local/folder/of/your/choice
git clone https://github.com/bcdev/jpy.git
cd jpy/
python setup.py bdist_wheel
cp dist/*.whl ~/.snap/snap-python/snappy

# set up snappy
# NOTE: customize paths here to where SNAP and Anaconda are
  installed
~/Applications/snap/bin/snappy-conf ~/local/anaconda/envs/SNAP/bin/python

cd ~/.snap/snap-python/snappy
python setup.py install

# test
python
import snappy # no error message = works.

Note: for advanced users, the Conda environment file is provided in the repository > req.txt

Example workflow

s3_extract_snow_products.py

Run python s3_extract_snow_products.py -h for help.

The scripts needs the following obligatory inputs:

The following optional inputs can be specified:

Example run:

python s3_extract_snow_products.py -i "/path/to/folder/containing/S3/folders"\
-c "/path/to/input/csvfile.csv" -o "/path/to/output/folder" -p false -d 0.05 -g false

Outputs: The output csv file contains:

s3_band_extract.py

Run python s3_band_extract.py -h for help.

The scripts needs the following obligatory inputs:

The following optional inputs can be specified:

Example run:

python s3_band_extract.py -i "/path/to/folder/containing/S3/folders"\
-c "/path/to/input/csvfile.csv" -o "/path/to/output/folder" -b Oa01_radiance quality_flags_bright SZA

Outputs: The output csv file contains:

list_sat_bands.py

Run python list_sat_bands.py -h for help.

The script takes only two inputs:

Example run:

python list_sat_bands.py -i "/path/to/folder/containing/S3/scene"\
-f "/path/to/output/textfile.txt"

Outputs: The output text file contains: