3

I know how to filter with a date range in Google Earth Engine, but I would like to filter a list of concrete dates which aren't consecutive, single days, for example, ['2005-08-05','2009-09-01','2017-02-08'].

var collection = ee.ImageCollection("MODIS/MYD11A1").select('LST_Day_1km');

var reference = collection.filterDate('2016-01-01', '2016-12-31')

1 Answer 1

7

Make a list of millisecond dates, and then use filter inList:

var collection = ee.ImageCollection("MODIS/MYD11A1").select('LST_Day_1km');

var reference = collection.filterDate('2016-01-01', '2016-12-31')

var datelist = ee.List(['2005-08-05','2009-09-01','2017-02-08'])
.map(function(date){return ee.Date(date).millis()})

var newcol = collection.filter(ee.Filter.inList("system:time_start", datelist))

print(newcol)
1

Your Answer

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

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