0

I try to calculate the burn area from MCD64A1.061 MODIS Burned Area Monthly Global 500m (https://developers.google.com/earth-engine/datasets/catalog/MODIS_061_MCD64A1) on GEE, based on the specific confidence level. The code worked perfectly until I attempted to filter the burn area based on the uncertainty, or the confidence level.

The error said: Number (Error) Dictionary.getNumber: Dictionary does not contain key: FireOccurance.

Here is the link to the code: https://code.earthengine.google.com/ee7eac7c6d03fb55cfe6000dd6336115?accept_repo=users%2Fgorelick%2FEE101-B

var dataset = ee.ImageCollection('MODIS/061/MCD64A1')
                .filterDate('2000-12-31', '2002-12-31')
                .filterBounds(ROI)
                .filter(ee.Filter.lt('Uncertainty', 30))

//create a function to calculate the area based on the pixel with "BurnDate", and clip with the ROI.
//ee.Image.pixelArea() method 
//which generates an image in which the value of each pixel is the pixel's area (m2).
var clip = function(image){
  return ee.Image.pixelArea()
                 .updateMask(image.select('BurnDate'))
                 .clip(ROI);
};

var clipDataset = dataset.map(clip)

//reduce the image until it pass through the first non-nill pixel value.
//rename the band
var burnedArea = clipDataset.reduce(ee.Reducer.firstNonNull())
                        .rename('FireOccurance');
                        
                        
var burnedAreaVis = {
  palette: ['ffaaa6', 'ff8178', 'ff5445', 'ff0000'],
};

Map.addLayer(burnedArea, burnedAreaVis, 'Total Burned Area');

var BAcalculation = burnedArea.reduceRegion({
  reducer: ee.Reducer.sum(),
  geometry: ROI,
  scale: 500,
  maxPixels: 1e9
});
// calculate the burn area and conver it from m2 to km2
var totalBurnedArea = BAcalculation.getNumber('FireOccurance').divide(1000000);
print(totalBurnedArea, 'Total burned area in km2')

Is it because I filtered the images according to the certain 'Uncertainty' band and also try to calculate the area based on the 'BurnData' band? How should I solve it?

1 Answer 1

1

The uncertainty is a band and you must call it as a band in a function and mask the pixels with higher uncertainty: here is corrected code: https://code.earthengine.google.com/b227d8e3ec5d270aba24ac21adb3e3b7?accept_repo=users%2Fgorelick%2FEE101-B

var dataset = ee.ImageCollection('MODIS/061/MCD64A1')
                .filterDate('2000-12-31', '2002-12-31')
                .filterBounds(ROI)
                .map(function(img){
                  var thr = img.select('Uncertainty').lt(30);
                  return img.updateMask(thr)
                  .copyProperties(img, img.propertyNames())
                  })
1
  • Thank you so much! It works! Commented Feb 28 at 12:14

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.