The odds to find snow in St. Moritz

Did you know that the St. Moritz Casino is the highest in Switzerland? If you like gambling, I have a little game for you: what are the odds to find snow near St. Moritz?

Badrutt's Palace Hotel in St. Moritz

Fortunately, I just finished the processing of 218 Sentinel-2 dates from 2015-Dec-04 to 2018-Apr-10 of tile 32TNS with our let-it-snow processor. I did this off-line production for a colleague because, as of today, Theia only distributes the snow products after July 2017 in this region of Switzerland (see the available products here).
A quick way to check the output is to compute a snow cover probability map: that is, for each pixel, the number of times that snow was observed divided by the number of times that the snow could be observed.
To compute this map we just need to know that the Theia snow products (LIS_SEB.TIF raster files) are coded as follows:
0: No-snow
100: Snow
205: Cloud including cloud shadow
254: No data
Here is a piece of script to do this:

# initialize snow.tif with zeros
# store in Byte because we have less than 255 dates
f0=$(find . -name LIS_SEB.TIF | head -1) --overwrite -A $f0 --type=Byte --calc=A*0 --outfile=snow.tif
# accumulate snow pixels in snow.tif
for f in $(find . -name LIS_SEB.TIF)
# snow is coded with 100 --overwrite -A $f -B snow.tif --type=Byte --calc="B+(A==100)" --outfile=snow.tif

# now do the same for clear.tif
# init --overwrite -A $f0 --type=Byte --calc=A*0 --outfile=clear.tif
# accumulate clear pixels in clear.tif
for f in $(find . -name LIS_SEB.TIF)
# only snow and no snow are coded with values lower than 101 --overwrite -A $f -B clear.tif --type=Byte --calc="B+(A<101)" --outfile=clear.tif

# Finally compute the snow probability in % (100.0* makes the calculation in float) -A snow.tif -B clear.tif --type=Byte --calc="(100.0*A)/B" --outfile=snowProba.tif

This is the output:

The images are scaled from 0 (black) to 100 (white). The units are number of days for snow and clear, percentage for snowProba.


From which you can map the odds to find snow near St. Moritz (click on the image to animate)!

Posted under: Sentinel-2, snow-ice, THEIA

Tagged as:

One comment

  • Dawit Berhane on 08/05/2018 at 05:44 said:

    Hi Simone,

    Just trying to mimic the recent flood event in Lake Eyre basin (24/03/2018):, based on one of your scripts.

    I am not familiar with flood mapping using Sentinel images and appreciate if you could check a slightly modified version of your script:

    // This script was originally written by Simon Ilyushchenko (GEE team) and ....

    // Default location
    var pt = ee.Geometry.Point(137.292, -28.175); // LAKE Eyre Basin

    // Load Sentinel-1 C-band SAR Ground Range collection (log scaling, VV co-polar)
    var collection = ee.ImageCollection('COPERNICUS/S1_GRD').filterBounds(pt)
    .filter(ee.Filter.listContains('transmitterReceiverPolarisation', 'VV'))

    // Filter by date
    var before = collection.filterDate('2018-02-18', '2018-03-20').mosaic();
    var after = collection.filterDate('2018-04-09', '2018-04-15').mosaic();

    // Threshold smoothed radar intensities to identify "flooded" areas.
    var SMOOTHING_RADIUS = 500;

    var diff_smoothed = after.focal_median(SMOOTHING_RADIUS, 'circle', 'meters')
    .subtract(before.focal_median(SMOOTHING_RADIUS, 'circle', 'meters'));

    var diff_thresholded =;

    // Display map
    Map.centerObject(pt, 13);
    Map.addLayer(before, {min:-30,max:0}, 'Before flood');
    Map.addLayer(after, {min:-30,max:0}, 'After flood');
    Map.addLayer(after.subtract(before), {min:-10,max:10}, 'After - before', 0);
    Map.addLayer(diff_smoothed, {min:-10,max:10}, 'diff smoothed', 0);
    {palette:"0000FF"},'flooded areas - blue',1);


Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>