How can I use the quality information stored in MODIS (500m) to create a mask for my MODIS (250m) image - e.g. cloud mask? When I merged the two image collections and run a function to detect the cloudy pixels, I got an error:

Error in map(ID=1_2018_01_01): Image.select: Pattern 'state_1km' did not match any bands. My code:

// A function to mask out cloudy pixels.
var maskClouds = function(image) {
  // Select the QA band.
  var QA = image.select('state_1km')
  // Make a mask to get bit 10, the internal_cloud_algorithm_flag bit.
  var bitMask = 1 << 10;
  // Return an image masking out cloudy areas.
  return image.updateMask(QA.bitwiseAnd(bitMask).eq(0))
// Get a feature collection with Mexico boundary
var countries = ee.FeatureCollection('ft:1tdSwUL7MVpOauSgRzqVTOwdfy17KDbw-1d9omPw')
var Mexico = countries.filter(ee.Filter.eq('Country', 'Mexico'));
var dataset = ee.ImageCollection('MODIS/006/MOD09GQ')
                  .filter(ee.Filter.date('2018-01-01', '2018-05-01'));
var terra = ee.ImageCollection("MODIS/006/MOD09GA"); 
var test = dataset.merge(terra)
.filterDate("2018-01-01", "2018-05-01");
var image = test
  • Welcome to GIS SE! Thank you for taking the tour. Please edit your question to include the text of any error message.
    – Andy
    Commented Jan 13, 2019 at 4:00
  • Hi @Andy, thanks for the comment, I edited my question including the error and my code. Cheers!
    – Marion
    Commented Jan 13, 2019 at 7:21

1 Answer 1


I think I found the solution. I changed the merge operator to combine and the code runs through:

var test = terra.combine(dataset).filterDate("2018-01-01", "2018-05-01"); 

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.