0

I am trying to get a monthly time series of MODIS evaporation for a point with the script below, however the problem is that it gives me the weekly values for every month. How can I modify this script to have only the average value of each month?

Script:

var geometry = /* color: #d63000 */ee.Geometry.Point([0, 0]);


var modisPET= ee.ImageCollection("MODIS/006/MOD16A2");
var collection05=ee.ImageCollection(modisPET.filterDate('2006-01-01', '2018-12-31'));
var clipped05=collection05.mean().clip(geometry)
var TS5=Chart.image.seriesByRegion(collection05,geometry,ee.Reducer.mean

(),'ET',2000,'system:time_start').setOptions({title:'PETLong-TermTimeSeries',vAxis:{title:'PET'},});
print(TS5);

1 Answer 1

0

Based on this answer: How to create and use a list of unique dates of images in an ImageCollection GEE you can build a list with all unique months and then create a new monthly image collection:

var monthlyMean = uniqueDatesSimple.map(function(date){
  
  var monthStart = ee.Date(date)
  var monthEnd = ee.Date(date).advance(1, 'month').advance(-1,'day')
  
  var subset = collection05.filterDate(monthStart,monthEnd);
  
  
  return ee.Image(subset.mean()).copyProperties(subset.first());
});

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

1
  • Thank you, indeed it works
    – Bouram
    Mar 25, 2022 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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