NBR - MODIS
For the MODIS, we are only going to look at the band maths variant for calculating the NBR, as there are no products with a readily accessible NBR band as it was for the NDVI.
We will again access the MOD09GA.006 Terra Surface Reflectance Daily Global 1km and 500m dataset.
Make sure to check the data documentation for the MODIS-dataset to find out which bands store which information and how to adress them.
Calculating the NBR
//Compute Normalized Burn Ratio over MOD09GA product.
//NBR = (NIR - SWIR) / (NIR + SWIR), where
//NIR is sur_refl_b01, 620-670nm
//SWIR is sur_refl_b07, 2105-2155nm
//Access boundary data
var extent_lebanon = ee.FeatureCollection("FAO/GAUL/2015/level0")
.filter(ee.Filter.eq('ADM0_NAME', 'Lebanon')); //filter for entry that equals the UN country name 'Lebanon'
//Center the map on the boundary of our AOI
Map.centerObject(extent_lebanon, 9);
//Access a MODIS ImageCollection
var modis = ee.ImageCollection('MODIS/006/MOD09GA')
.filterBounds(extent_lebanon)
.filterDate('2020-07-01', '2020-07-31')
.select('sur_refl_b01', 'sur_refl_b02', 'sur_refl_b03', 'sur_refl_b04', 'sur_refl_b05', 'sur_refl_b06', 'sur_refl_b07')
//Turn MODIS ImageCollection into a single Image by reducing it to the median, then clip it to the boundary of our AOI
var modis_median = modis.median()
.clip(extent_lebanon);
print(modis_median, 'July 2020 Lebanon MODIS');
Map.addLayer(modis_median.select(['sur_refl_b01', 'sur_refl_b04', 'sur_refl_b03']),
{gain: [0.1, 0.1, 0.1]}, 'MODIS July 2020 Lebanon Bands 1/4/3');
// Use the normalizedDifference(A, B) to compute (A - B) / (A + B)
var nbr = modis_median.normalizedDifference(['sur_refl_b02', 'sur_refl_b07']);
print(nbr, 'NBR July 2020 Lebanon MODIS');
// Create a variable containing NBR-Visualization parameters
var nbrParams = {min: -1, max: 1, palette: ['red', 'white', 'green']};
// Display the input image and the NBR derived from it.
Map.addLayer(nbr, nbrParams, 'NBR MODIS July 2020 Lebanon');