I face a problem regarding the selection of good quality data of the MCD64A1 burned area product. Here, is a description of the QA band but I am really confused with the different bits.
What I want to do is to select all the good quality observations over land and mask the collection based on them. I have the following, but it is nt the right way to do this.
var geometry = /* color: #d63000 */ee.Geometry.Polygon(
[[[23.821277851635955, 46.07285332090363],
[23.274708027417205, 45.952681148559265],
[24.11378883796408, 45.554067690813184],
[24.89381813483908, 45.84372892769175],
[24.17146706062033, 46.25167241706428]]]);
var dataset = ee.ImageCollection('MODIS/006/MCD64A1')
.filterBounds(geometry)
.map(function(image){return image.clip(geometry)})
.filter(ee.Filter.calendarRange(7,7,'month'));
var burnedArea = dataset.select('BurnDate','QA');
//good quality observations
var good= (function(img) {
var goodQA = img.select("QA").eq(1);
return img.updateMask(burnedArea .and(goodQA));
});
EDIT
Also, I have tried the following which gives me no error but also no data.
var good= function(img){
var qa = img.select(['QA']);
var mask = qa.bitwiseAnd(0).eq(1).and(
qa.bitwiseAnd(1).eq(1)).and(
qa.bitwiseAnd(2).eq(1));
return img.updateMask(mask);
};