Operational snow cover product from Sentinel-2 and Landsat-8 THEIA L2A data – README.md




This code is a Python/OTB version of the snow cover extent detection algorithm for Sentinel-2 and Landsat-8 data.

The algorithm documentation with examples is available here:

To read more about the "Centre d'Expertise Scientifique surface enneigée" (in French):

The input files are Sentinel-2 or Landsat-8 level-2A products from the Theai Land Data Centre or SPOT-4/5 Take 5 level-2A products and the SRTM digital elevation model reprojected at the same resolution as the input image.


Run the python script run_snow_detector.py with a json configuration file as unique argument:

python run_snow_detector.py param.json

The snow detection is performed in the Python script run_snow_detector.py.

All the parameters of the algorithm, paths to input and output data are stored in the json file. See the provided example param_test_s2_template.json file for an example.

Moreover The JSON schema is available in the Algorithm theoritical basis documentation and gives more information about the roles of these parameters.

NB: To build DEM data download the SRTM files corresponding to the study area and build the .vrt using gdalbuildvrt. Edit config.json file to activate preprocessing : Set "preprocessing" to true and set the vrt path.

Products format

  • COMPO: Raster image showing the outlines of the cloud (including cloud shadow) and snow masks drawn on the RGB composition of the L2A image (bands SWIR/Red/Green).
  • SNOW_ALL: Binary mask of snow and clouds.
    • 1st bit: Snow mask after pass1
    • 2nd bit: Snow mask after pass2
    • 3rd bit: Clouds detected at pass0
    • 4th bit: Clouds refined at pass0

For example if you want to get the snow from pass1 and clouds detected from pass1 you need to do:

pixel_value & 00000101
  • SEB: Raster image of the snow mask and cloud mask.
    • 0: No-snow
    • 100: Snow
    • 205: Cloud including cloud shadow
    • 254: No data
  • SEB_VEC: Vector image of the snow mask and cloud mask. Two fields of information are embbeded in this product. DN (for Data Neige) and type.
    • DN field :
      • 0: No-snow
      • 100: Snow
      • 205: Cloud including cloud shadow
      • 254: No data
    • Type field:
      • no-snow
      • snow
      • cloud
      • no-data

Data set example

Sequence of snow maps produced from Sentinel-2 type of observations (SPOT-5 Take 5) over the Deux Alpes and Alpe d'Huez ski resorts are available on Zenodo.


Code to generate the snow cover extent product on Theia platform.



lis dependencies:

GDAL >=2.0 OTB >= 6.0 Boost-Python Python interpreter >= 2.7 Python libs >= 2.7 Python packages: numpy lxml matplotlib

GDAL itself depends on a number of other libraries provided by most major operating systems and also depends on the non standard GEOS and PROJ4 libraries. GDAl- Python bindings are also required

Python package dependencies: sys, subprocess, glob, os, json, gdal

Installing from the source distribution


In your build directory, use cmake to configure your build.

cmake -C config.cmake source/lis/

In your config.cmake you need to set :


For OTB superbuild users these cmake variables need to be set:


Run make in your build folder.


To install let-it-snow application and the s2snow python module. In your build folder:

make install

Add appropriate executable rights

chmod -R 755 ${install_dir}

The files will be installed by default into /usr/local and add to the python default modules. To overide this behavior, the variable CMAKE_INSTALL_PREFIX must be configure before build step.

Update environment variables for LIS. Make sure that OTB and other dependencies directories are set in your environment variables:

export PATH=/your/install/directory/bin:/your/install/directory/app:$PATH
export LD_LIBRARY_PATH=/your/install/directory/lib:$LD_LIBRARY_PATH
export OTB_APPLICATION_PATH=/your/install/directory/lib:$OTB_APPLICATION_PATH
export PYTHONPATH=/your/install/directory/lib:/your/install/directory/lib/python2.7/site-packages:$PYTHONPATH

let-it-snow is now installed.


Enable tests with BUILD_TESTING cmake option. Use ctest to run tests. Do not forget to clean your output test directory when you run a new set of tests.

Data (input and baseline) to run validation tests are available on Zenodo.

Download LIS-Data and extract the folder. It contains all the data needed to run tests. Set Data-LIS path var in cmake configuration files. Baseline : Baseline data folder. It contains output files of S2Snow that have been reviewed and validated. Data-Test : Test data folder needed to run tests. It contains Landsat, Take5 and SRTM data. Output-Test : Temporary output tests folder. Do not modify these folders.


Manuel Grizonnet (CNES), Simon Gascoin (CNRS/CESBIO), Tristan Klempka (CNES)


This is free software under the GNU Affero General Public License v3.0. See http://www.gnu.org/licenses/agpl.html for details.