0

I try to use "QC_250m" to mask out cloud pixels from MODIS daily reflectance 250m collection, but it did not completely remove cloud pixels.

Here is the code

var terra = ee.ImageCollection("MODIS/061/MOD09GQ").filterDate("2020", "2023");
var cloud_mask = function(img){
  
  var qa = img.select("QC_250m");
  var cloudBitMask = ee.Number(2).pow(0).int()
  var mask = qa.bitwiseAnd(cloudBitMask).eq(0)
  return img.updateMask(mask)
}

var modis = terra.map(cloud_mask)

Map.addLayer(modis.first(), {}, "Cloud-free")

Here is the code link https://code.earthengine.google.com/43d8627435697b4fb11f1600e9ae650b

1 Answer 1

2

The MOD09GQ product doesn't contain a cloud indicator. The QA band only tell you if the pixel could be processed, not whether it has clouds.

Typically, people combine the MOD09GA and GQ collections, and use the state_1km band to get at a cloud mask.

var maskClouds = function(image) {
  var QA = image.select('state_1km')
  var bitMask = 1 << 10;
  return image.updateMask(QA.bitwiseAnd(bitMask).eq(0))
}

var dataset = ee.ImageCollection('MODIS/061/MOD09GQ')
  .linkCollection(ee.ImageCollection("MODIS/061/MOD09GA"), ["state_1km"])
  .filter(ee.Filter.date('2018-01-01', '2018-05-01'))
  .map(maskClouds)
0

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