4

I'm trying to estimate the total of clear days in a year with the help of state_1km band in the MOD09GA product. But I'm not sure if it is right, also the possible counts are higher than expected when compared with cloud cover observation at weather stations.

  // Load morning (Terra) MODIS data.
        var morning = ee.ImageCollection('MODIS/006/MOD09GA');

        // A function to extract cloudiness data from a MODIS image.
        function clear(image) {
          // The cloud state is in the low two bits of the 'state_1km' band.
      var cloudState = image.select('state_1km').bitwiseAnd(0x03);
      // 0:clear, 1:cloudy, 2 means mixed, and 3:missing data. 
      return cloudState.float()
         .remap([0,1],[1,0])
         .updateMask(cloudState.neq(3))
        .updateMask(cloudState.neq(2));
     }

    var select_morning = morning.filter(ee.Filter.calendarRange(2015,2015,'year'));
    var clear_days = select_morning.map(clear);

    var count = clear_days.reduce(ee.Reducer.sum());
1
  • The code isn't reproducible...
    – aldo_tapia
    Mar 29, 2018 at 12:44

1 Answer 1

2

Yes, The computation is ok, I got the same results:

var getQABits = function(image, start, end, newName) {
    // Compute the bits we need to extract.
    var pattern = 0;
    for (var i = start; i <= end; i++) {
       pattern += Math.pow(2, i);
    }
    return image.select([0], [newName])
                  .bitwiseAnd(pattern)
                  .rightShift(start);
};

// Load morning (Terra) MODIS data.
var morning = ee.ImageCollection('MODIS/006/MOD09GA');

var clear = function(image){
  var img = image.select('state_1km');
  return getQABits(img,0,1,'Clouds').expression("b(0) == 0 || b(0) == 3");
};

var clear_days = morning.filter(ee.Filter.calendarRange(2015,2015,'year'))
                        .map(clear);
var count = clear_days.reduce(ee.Reducer.sum());
Map.addLayer(count,{min:0,max:365},'Number of clear days of 2015');

Is difficult to obtain the same results from a weather station. A weather station is acquiring data every minute, hour or another time range. MODIS acquire data from 1 to 5 times per day:

// Mean number of observations
var mean_obs = morning.filter(ee.Filter.calendarRange(2015,2015,'year'))
                      .select('num_observations_1km').reduce(ee.Reducer.mean());
Map.addLayer(mean_obs,{min:1,max:5},'Mean number of observations');

Also, the resolution of MODIS data is really coarse compared to a weather station. Will be only an approximation. Compare daily data from the coordinates of your weather station to find relations prior to a rectification.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.