I want to calculate the NDVI index based on the MODIS/006/MCD43A4 collection and based on quality bands, but as a new GEE user I have no idea If I am on the rght way to do this. So far I have the following :
var imageCollection = ee.ImageCollection("MODIS/006/MCD43A4")
//.select(['Nadir_Reflectance_Band2', 'Nadir_Reflectance_Band1'], ['NIR', 'RED']).multiply(0.0001)
.filterBounds(geometry)
.map(function(image){return image.clip(geometry)})
.filter(ee.Filter.calendarRange(10,11,'month')),
geometry = /* color: #d63000 */ee.Geometry.Polygon(
[[[74.31655930070895, 56.84897198026647],
[71.72378586320895, 53.54030739149663],
[81.04019211320895, 51.563412328672136],
[87.80777023820895, 55.429013452403986]]]);;
var modNDVI = imageCollection.select("Nadir_Reflectance_Band2","Nadir_Reflectance_Band1","BRDF_Albedo_Band_Mandatory_Quality_Band1","BRDF_Albedo_Band_Mandatory_Quality_Band2");
var filterqa = function(feature){
var image = ee.Image(feature);
var QAImage = image.select(['BRDF_Albedo_Band_Mandatory_Quality_Band1']);
var QAImage2 = image.select(['BRDF_Albedo_Band_Mandatory_Quality_Band2']);
var maskedImage = ee.Image(0)
.where((QAImage.eq(0),1)&&(QAImage2.eq(0),1));
return image.mask(maskedImage);
};
var md_masked= modNDVI.map(filterqa);
var ndvi = (function(image) {
return image.expression('(NIR - RED) / (NIR + RED)', {
'NIR': image.select('Nadir_Reflectance_Band2').multiply(0.0001).float(),
'RED': image.select('Nadir_Reflectance_Band1').multiply(0.0001).float(),
}).clamp(-1, 1);
});
print(imageCollection)
//var ndviParams = {min: -1, max: 1, palette: ['blue', 'white', 'green']};
//Map.addLayer(, ndviParams, 'NDVI');
From the imageCollection
, I see that each image has 14 bands from which, 7 (7-13) have quality information. How can I calculate the NDVI index based on the good quality observations?
I am really confused as there is no a SummaryQA
band simillar to the one from the MOD13Q1
.