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')
//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'))
  return w.set('year', y)
           .set('month', m)
           .set('date', ee.Date.fromYMD(y,m,1))



How do I do a decadal composite (every 10 days)?


First make a ten day interval list:

// settings for the years to filter on
var interval = 10;
var increment = 'day';
var start = '2018-01-01';
// make a list of start years
var startDate = ee.Date(start);
var secondDate = startDate.advance(interval, increment).millis();
var increase = secondDate.subtract(startDate.millis());
var list = ee.List.sequence(startDate.millis(), ee.Date('2019-01-01').millis(), increase);

Then map over that list and filter to get images in that daterange:

// monthly composite
var tenDaysMeans =  ee.ImageCollection.fromImages(list.map(function(date){
  return col.select('B1').filterDate(ee.Date(date), ee.Date(date).advance(interval, increment))


As a side note, sentinel-2 has a five-day return period, so within a 10 day composite you will possibly have too less images to create meaningfull composites.

link code

  • works perfectly. Thanks @Kiuk very much! – Minh Shines May 7 '19 at 9:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.