I am trying to make mean Sentinel-2 images of an area for each day from May 1st to June 30th over several years. I've never used google earth engine/javascript before, so it's been a bit challenging.
Here's what I've come up with so far, copy pasted together from various sources:
///cloud mask (included just in case my error comes from here)
function maskS2clouds(image) {
var qa = image.select('QA60');
var cloudBitMask = 1 << 10;
var cirrusBitMask = 1 << 11;
var mask = qa.bitwiseAnd(cloudBitMask).eq(0)
.and(qa.bitwiseAnd(cirrusBitMask).eq(0));
return image.updateMask(mask).divide(10000)
.copyProperties(image, image.propertyNames());
}
///making an image collection over the relevant area/time period
var tiles = ['32VKM','32VLM']
var hardanger = ee.ImageCollection('COPERNICUS/S2').filter(ee.Filter.dayOfYear(120,180))
.filter(ee.Filter.inList('MGRS_TILE', tiles))
.filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 10))
.map(maskS2clouds);
//getting the mean image per day:
var days = ee.List.sequence(120, 180);
var byDay = ee.ImageCollection.fromImages(
days.map(function(y) {
return hardanger
.filter(ee.Filter.calendarRange(y, y, 'DAY_OF_YEAR'))
.reduce(ee.Reducer.mean())
.set('DAY_OF_YEAR', y);
})
);
print(byDay, "byDay");
It seems to work fine and I do get 61 images, which seems about right (some are empty/no bands which I assume is because the satellite does not pass on those days).
However, all the images look exactly the same?