I have function which calculates monthly means from an image collection
var UK_SST = ee.ImageCollection('NOAA/CDR/SST_WHOI/V2').select('sea_surface_temperature')
.filterDate(ee.Date('1990-01-01'), ee.Date('2019-01-01'))
.filterBounds(ROI)
// month data for dataset
var startyear = 1990;
var endyear = 2019;
var startmonth = 1;
var endmonth = 12;
var startdate = ee.Date.fromYMD(startyear, startmonth, 1);
var enddate = ee.Date.fromYMD(endyear , endmonth, 1);
var years = ee.List.sequence(startyear, endyear);
var months = ee.List.sequence(1, 12);
var monthlySST = ee.ImageCollection.fromImages(
years.map(function (y) {
return months.map(function(m) {
var w = UK_SST.filter(ee.Filter.calendarRange(y, y, 'year'))
.filter(ee.Filter.calendarRange(m, m, 'month'))
.mean();
return w.set('year', y)
.set('month', m)
.set('system:time_start', ee.Date.fromYMD(y, m, 1));
});
}).flatten()
);
I'm looking to set the band value as a property so I can export the image collection as a csv with the band values contained. However, when I try to set this
.set("sst_mean", w.get("sea_surface_temperature"))
In this part of the function.
return w.set('year', y)
.set('month', m)
.set("sst_mean", res.get("sea_surface_temperature"))
.set('system:time_start', ee.Date.fromYMD(y, m, 1));
Nothing gets set. Any ideas?