My goal is to get monthly NDVI medians in Google Earth Engine. This helpful post got me started: reduce image collection to get annual monthly sum precipitation
However, I am using Landsat (not MODIS). This script does run but the map layer has "no bands to visualize".
- How can I visualize the bands? (Maybe the issue is that this dataset only has 1 band?).
- How can I add all 12 map layers, one per month? (perhaps with stacking?)
var ndvi = ee.ImageCollection('LANDSAT/LT5_L1T_32DAY_NDVI');
var months = ee.List.sequence(1, 12);
// Group by month, and then reduce within groups by mean();
// the result is an ImageCollection with one image for each
// month.
var byMonth = ee.ImageCollection.fromImages(
months.map(function (m) {
return ndvi.filter(ee.Filter.calendarRange(m, m, 'month'))
.select().median()
.set('month', m);
}));
print(byMonth);
Map.addLayer(ee.Image(byMonth.first()));
No comments:
Post a Comment