My code has been adapated from Code for monthly NDVI medians in Google Earth Engine to calculate average sst by month and year

var sst = ee.ImageCollection('NASA/OCEANDATA/MODIS-Aqua/L3SMI')
.filterDate(ee.Date('2013-01-01'), ee.Date('2017-12-31'))

var months = ee.List.sequence(1, 12);
var years = ee.List.sequence(2013, 2017);

var byMonthYear = ee.ImageCollection.fromImages(years.map(function(y) {
return months.map(function (m) {
  return sst
    .filter(ee.Filter.calendarRange(y, y, 'year'))
    .filter(ee.Filter.calendarRange(m, m, 'month'))
    .set('month', m).set('year', y);
 print('byMonthYear', byMonthYear)

I simply want to a) export this data as a table, and b) plot this data by monthly mean over different years, similar to the DOY series in this guide.

For a) From the GEE guide I used this code for the table. However, the table in tasks spends a long time initializing and never resolving.

// Make a feature without geometry and set the properties to the dictionary 
of means.
var feature = ee.Feature(null, byMonthYear);

// Wrap the Feature in a FeatureCollection for export.
var featureCollection = ee.FeatureCollection([feature]);

// Export the FeatureCollection.
collection: featureCollection,
description: 'BIOT_sst',
fileFormat: 'CSV'

For b) I've yet to find a way to plot different years without using the DOY series which isn't applicable here.

Your Answer

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

Browse other questions tagged or ask your own question.