I want to make a simple time-series of snow cover in a study area in Norway.

I modified the script below from another post: Generation of snow cover area time series in GEE using MODIS Snow Cover product

[![snow-cover time series][1]][1]

However, the results do not make sense, as the appears to be no snow in the winter period, which is incorrect. I assume this is because of the solar mask (var solar = 1<<7). Is it actually possible to use MODIS snow cover product in this way if the area is dark over winter? Or would one need to use a different product?

var geometry =   ee.FeatureCollection(
                [[[6.091015486138067, 61.49993218686026],
                  [6.091015486138067, 61.488790444662556],
                  [6.108868269341192, 61.488790444662556],
                  [6.108868269341192, 61.49993218686026]]], null, false),
              "system:index": "0"

var locations = geometry;

//aqua daily LST dataset (1km spatial resolution) - Land surface temperature
var AquaLST = ee.ImageCollection('MODIS/006/MYD11A1')
                .filter(ee.Filter.date('2020-07-01', '2022-07-01'))
                .map(function(img) {
                    return img.clip(locations);

//terra daily snow cover dataset (500m spatial resolution) to be resampled to 1km using aqua daily LST dataset
var TerraSnowCover = ee.ImageCollection('MODIS/006/MOD10A1')
                        .filter(ee.Filter.date('2020-07-01', '2022-07-01'))
                        .map(function(img) {
                          return img //.reproject({ crs: AquaLST.projection() })

//create mask to extract only 'best' and 'good' quality data (values 0 and 1 in all the 16 bits)
//also create mask to extract pixels without inland water (bit0),
//no visible screen failure (bit1), no ndsi screen failure (bit2) and
//no solar zenith screen failure (bit7) 
//Refer:-   https://developers.google.com/earth-engine/datasets/catalog/MODIS_006_MOD10A1?hl=en
var filter = function(image){ 
  var basicQA = image.select('NDSI_Snow_Cover_Basic_QA');
  var basicBitMask = 1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9|1<<10|1<<11|1<<12|1<<13|1<<14|1<<15;
  var basicBitwiseResult = basicQA.bitwiseAnd(basicBitMask);
  var basicMask = basicBitwiseResult.eq(0).or(basicBitwiseResult.eq(1));
  var flagsQA = image.select('NDSI_Snow_Cover_Algorithm_Flags_QA');
  var inland = 1<<0;
  var visible = 1<<1;
  var ndsi = 1<<2;
  var solar = 1<<7;
  var Inland = (flagsQA.bitwiseAnd(inland)).eq(0);
  var Visible = (flagsQA.bitwiseAnd(visible)).eq(0);
  var NDSI = (flagsQA.bitwiseAnd(ndsi)).eq(0);
  var Solar = (flagsQA.bitwiseAnd(solar)).eq(0);
  var mask = basicMask.and(Inland).and(Visible).and(NDSI).and(Solar);
  image = image.updateMask(mask);
  //Calculation of masked pixel area
  var area = mask.divide(mask)
  image = image.addBands(area);
  var stats = area.reduceRegion({
    reducer: ee.Reducer.sum(), 
    geometry: geometry, 
    scale: 1000,
  return image.set(stats);

//apply basic & flags QA mask to image collection
var TSC = TerraSnowCover.map(filter);

//Charting Terra Snow Cover over geometry
print(Chart.image.series(TSC.select('Area'), geometry,ee.Reducer.sum()).setOptions({
   title: "Time Series of MODIS Terra Daily Snow Cover across geometry",
   hAxis: {
     title: "Time Period",
     titleTextStyle: {italic: false, bold: true}
   vAxis: {
     title: "Snow Cover Area",
     titleTextStyle: {italic: false, bold: true}
   colors: ["Red"]

  [1]: https://i.stack.imgur.com/CtreC.png


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy