Snow Cover Change Detection

//VERSION=3 (auto-converted from 1)

/*
Author: Karl Chastko
*/


function setup() {
  return {
    input: [{
      bands: [
          "B03",
          "B11"
      ]
    }],
    output: { bands: 3 },
    mosaicking: "ORBIT"
  }
}


function calcNDSI(sample) {
  ndsi = (sample.B03 - sample.B11)/ (0.01 + sample.B03 + sample.B11);
  return ((ndsi>0.2)&(sample.B03>0.15)) ? (ndsi) : 0.0
}

function evaluatePixel(samples,scenes) {
  var avg1 = 0;
  var count1 = 0;
  var avg2 = 0;
  var count2 = 0;
  var avg3 = 0;
  var count3 = 0;
  var endMonth = scenes[0].date.getMonth();

  for (var i=0;i<samples.length;i++) {
      var ndvi = calcNDSI(samples[i]);
      if (scenes[i].date.getMonth()==endMonth)
      {
		avg3 = avg3 + ndvi;
        count3++;
      }
      else if (scenes[i].date.getMonth()==(endMonth-1))
      {
		avg2 = avg2 + ndvi;
        count2++;
      }
      else
      {
		avg1= avg1 + ndvi;
        count1++;
      }

  }
  avg1 = avg1/count1;
  avg2 = avg2/count2;
  avg3 = avg3/count3;

  return [avg1*5,avg2*5,avg3*5];

}
function preProcessScenes (collections) {
  collections.scenes.orbits = collections.scenes.orbits.filter(function (orbit) {
      var orbitDateFrom = new Date(orbit.dateFrom)
      return orbitDateFrom.getTime() >= (collections.to.getTime()-3*31*24*3600*1000);
  })
  return collections
}

Evaluate and Visualize

General description of the script

The Snow Cover Change Detection script calculates the NDSI for any given region for the last three months and renders the results so that areas which have gained/lost snow can be easily identified.

This script works great for viewing snowfall in the autumn months or snow retreat in the spring. Additionally, this script can be used to visualize glacial retreat or advance in polar or high mountain regions.

Author of the script

Karl Chastko

Description of representative images

The images below demonstrate how the script can be used to track glacial retreat and spring snowmelt.

The first image shows the summer retreat of the Athabasca glacier in Western Alberta Canada from June 2018 - August 2018. Snow Cover Change Detection script example 1

The second image displays patterns of spring thaw (largely related to local topography) along the Manitoba escarpment in Manitoba Canada. Snow Cover Change Detection script example 2

Generally speaking regions in blue and green highlight areas which have high snow cover in the earliest months while red values highlight areas which maintain snow cover in the later months. Combinations of these colors represent areas which remain snow covered across multiple time periods. Images show the result of the script using the default parameters.