1

I'm using GRIDMET image collection in Google Earth Engine, which has daily climate data from ~1980 to present. I would like to create an image collection of monthly (May-September: each month) sum precipitation for each year (1986-2016). I've been trying to create a function to do so, but can't figure it out.

https://code.earthengine.google.com/ceba35ee52955ec5e174e0293cebb7b8

  • With ee.Filter.calendarRange(start,end,field) you can select by month or year. But I don't know how to create a function to do this – aldo_tapia Oct 12 '17 at 19:28
  • I'm using GSMaP image collection in Google Earth Engine, which has hourly precipitation data from 2000 to present. I have a script which helps getting data (as a table) from points from each available image in given period. Could anyone please assist me on how to make the function that it will sum the values of hourly data to daily. Please, find the script which should be improved below: //Points var p1 = /* color: #d63000 /ee.Geometry.Point([69.15, 54.8331]), p2 = / color: #98ff00 /ee.Geometry.Point([70.917, 54.433]), p3 = / color: #0b4a8b */ee.Geometry.Point([66.967, 54.367]); // Collect – Sarvarbek Eltazarov May 3 '18 at 9:58
  • Welcome to GIS SE. Please, add a new question instead to add this post as an answer – aldo_tapia May 3 '18 at 12:08
  • If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review – aldo_tapia May 3 '18 at 12:08
6

Here is an example that should get you started:

var modis = ee.ImageCollection('MODIS/MOD13A1');

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

// Group by month, and then reduce within groups by mean();
// the result is an ImageCollection with one image for each
// month.
var byMonth = ee.ImageCollection.fromImages(
      months.map(function (m) {
        return modis.filter(ee.Filter.calendarRange(m, m, 'month'))
                    .select(1).mean()
                    .set('month', m);
}));
print(byMonth);

Map.addLayer(ee.Image(byMonth.first()));

Obviously you're going to want to replace the mean() with sum(), etc.

  • @KevinBarnes If this answers your question please mark this as the correct answer using the grey/green tick to the left of this post. – Kersten Oct 15 '17 at 8:06

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.