A monthly composite can be made using the following code, I take example from Sentinel 2 L1C:
var geometry = ee.Geometry.Point([109.061, 11.78]);
var col = ee.ImageCollection('COPERNICUS/S2')
.filterBounds(geometry).filterDate('2018-01-01','2019-01-01');
//Monthly Images
var months = ee.List.sequence(1,12);
var years = ee.List.sequence(2018,2018);
// monthly composite
var monthlyImages = ee.ImageCollection.fromImages(
years.map(function (y) {
return months.map(function(m){
var w = col.select('B1').filter(ee.Filter.calendarRange(y, y, 'year'))
.filter(ee.Filter.calendarRange(m, m, 'month'))
.mean()
//.median()
//.min()
.set('system:time_start',ee.Date.fromYMD(y,m,1));
return w.set('year', y)
.set('month', m)
.set('date', ee.Date.fromYMD(y,m,1))
.set('system:time_start',ee.Date.fromYMD(y,m,1))
});
}).flatten());
print(monthlyImages)
How do I do a decadal composite (every 10 days)?
No comments:
Post a Comment