I've computed water area for each 8 days for about 20 years. I don't know how can I compute monthly area for these years? or How can I change 8 days product to the monthly in this code?

code link: https://code.earthengine.google.com/590d4cf09f90e591d69ed3a03039d4f7


var modis = ee.ImageCollection('MODIS/006/MOD09A1')

  var id = img.id();

  var scale = img.multiply(0.0001);
  var clip = scale.clip(geometry);
  var index = clip.normalizedDifference(['sur_refl_b03','sur_refl_b02']);

  var thr = index.gte(0.1);

  var mask = index.updateMask(thr);

 var area = mask.multiply(ee.Image.pixelArea().divide(1000000.0));

  return area


var chart = ui.Chart.image.series(modis, geometry, 
ee.Reducer.sum(), 1000, 'system:time_start');


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.