I have image collection from that I want to make a loop function where I want to call all images that have the same temporal resolution but date range varies (like 2000-06-09 to 2019-06-17) through the time series and calculates one max and one min for this date range. how to do this?

//Image listing
var modis = ee.ImageCollection("MODIS/006/MOD13Q1").filterBounds(table).select('NDVI');

var modis_list = [];
for(var i = 6; i <=10; i++) {
  for(var j = 2000; j <=2019; j++){
    modis_list.push(modis.filter(ee.Filter.calendarRange(i, i, 'month'))
                          .filter(ee.Filter.calendarRange(j, j, 'year')));
var modis_filtered_flattened = 


1 Answer 1


I'm not sure I understand what you're trying to do. I'm guessing you want imagery for a number of years, but only for certain dates. Then you want the min and max value for each pixel. If so, this could be a way to do that:

 var region = Map.getBounds(true)
 var startDate = '2000-06-09'
 var endDate = '2019-06-17'

 var startDayOfYear = ee.Date(startDate).getRelative('day', 'year')
 var endDayOfYear = ee.Date(endDate).getRelative('day', 'year')

 var modis = ee.ImageCollection("MODIS/006/MOD13Q1")
  .filterDate(startDate, endDate)
  .filter(ee.Filter.dayOfYear(startDayOfYear, endDayOfYear))

var minMax = modis  

var visParams = {min: 500, max: 9500, palette: 'red,orange,yellow,green'}  
Map.addLayer(minMax.select('NDVI_min'), visParams, 'min')
Map.addLayer(minMax.select('NDVI_max'), visParams, 'max')


  • Thank you, sir, for your kind help what I want to do it's quite similar to your suggested code.
    – swarup
    Apr 11, 2020 at 14:58

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.