I am trying to export monthly NDVI values for 2007 for my asset 'M2007' which is a mangrove extent shapefile. I've been able to export following the same code, the monthly ndvi values for 2012, apart from one month that was missing a value (I'm not sure why either).
What can I do to acquire this data?
https://code.earthengine.google.com/3eb83ce8d46725356b871d94c663f97e
///////////////////////////////////////
function maskL457sr(image) {
var qaMask = image.select('QA_PIXEL').bitwiseAnd(parseInt('11111', 2)).eq(0);
var saturationMask = image.select('QA_RADSAT').eq(0);
var opticalBands = image.select('SR_B.').multiply(0.0000275).add(-0.2);
var thermalBand = image.select('ST_B6').multiply(0.00341802).add(149.0);
return image.addBands(opticalBands, null, true)
.addBands(thermalBand, null, true)
.updateMask(qaMask)
.updateMask(saturationMask);
}
var l7 = ee.ImageCollection("LANDSAT/LE07/C02/T1_L2")
.filterDate('2007-01-01', '2007-12-31')
.filterBounds(roi)
.map(maskL457sr)
var months = ee.List.sequence(1, 12);
var monthlyNDVIList = months.map(function (month) {
var startDate = ee.Date.fromYMD(2007, month, 1);
var endDate = startDate.advance(1, 'month');
var l7Monthly = l7
.filterDate(startDate, endDate)
.median()
.clip(roi);
var ndvi = l7Monthly.normalizedDifference(['SR_B4', 'SR_B3']);
var meanNDVI = ndvi.reduceRegion({
reducer: ee.Reducer.mean(),
geometry: roi,
scale: 30,
maxPixels: 1e9
}).get('nd');
return ee.Feature(null, {
'Month': month,
'Mean_NDVI': meanNDVI,
});
});
var monthlyNDVICollection = ee.FeatureCollection(monthlyNDVIList);
Export.table.toDrive({
collection: monthlyNDVICollection,
description: 'Monthly_NDVI_2007',
folder: 'GEE',
fileFormat: 'CSV'
});