I'm trying to mask each modis image using the QA layer. As far as I understand, the part .select("QA").eq(0)
should remove all pixels with no ideal quality for all bands. However, when I make a plot with Map.addLayer(ls7.first())
it seems like there is no pixel in any part of the world with the best quality.
It seems strange, is something wrong with my code? When I use .select("StateQA").eq(0)
it seems that only some sparse pixels (most of them in the sea) are ok. Any suggestions?
This is my code:
//select collection
var ls7SR = ee.ImageCollection('MODIS/006/MOD09A1');
// calculate normalized burn ration
var ls4_7_Indices = function(lsImage){
var nbr = lsImage.normalizedDifference(['sur_refl_b02', 'sur_refl_b07']).toFloat();
nbr = nbr.updateMask(lsImage.select("QA").eq(0));
return nbr.copyProperties(lsImage, ['system:time_start']);
};
// Map functions across modis Collection
var ls7 = ls7SR.map(ls4_7_Indices)
Map.addLayer(ls7.first())