I would like to create a list or array object containing a unique set of dates represented in an image collection for a given region of interest. I have a function that extracts and converts dates for each image to a number, and stores these as a list. However, there are often multiple images (tiles) for the same date, meaning the date list has many duplicates. How can I filter out replicate dates to get a unique date list?
See code here: https://code.earthengine.google.com/20de3ef240fd96d1b25f0b52b9dce5f3
Map.addLayer(roi,{})
Map.centerObject(roi,7);
//Dates of Interest
var start = ee.Date("2014-10-01");
var finish = ee.Date("2018-05-01");
///--------------------- Landsat Collection ---------------------------------------///
var landsat = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')
.filterDate(start, finish)
.filterBounds(roi);
// Year-Month-Day Extract function
function ymdList(imgcol){
var iter_func = function(image, newlist){
var date = ee.Number.parse(image.date().format("YYYYMMdd"));
newlist = ee.List(newlist);
return ee.List(newlist.add(date).sort())
};
return imgcol.iterate(iter_func, ee.List([]));
}
print(ymdList(landsat))
Best Answer
You can find out how many images are available per date with the
frequencyHistogram
reducer. Script with example roi.