Open Towhid-Islam opened 1 year ago
I modified the codes like this:
var medoidMosaic = function(inCollection, dummyCollection) {
var imageCount = inCollection.toList(1).length();
var finalCollection = ee.ImageCollection(ee.Algorithms.If(imageCount.gt(0), inCollection, dummyCollection));
var median = finalCollection.median();
var difFromMedian = finalCollection.map(function(img) {
var diff = (ee.Image(img).subtract(median)).abs();
return diff.reduce('sum').multiply(-1).addBands(img);
});
return ee.ImageCollection(difFromMedian).qualityMosaic('sum').select([1,2,3,4,5,6], ['B1','B2','B3','B4','B5','B7']);
};
Could you please let me know what you think about it. Thanks a lot!
Can you send a script that shows how you arrived at these conclusions?
Thank you! (I may not be able to look or respond until the week of Oct 16th)
Thank you so much for your kind response. Here is the script link: (https://code.earthengine.google.com/e7ab3f7ecd228feccc47db989dd3be13)
If you inspect a point, you see band values of both Output_ReducerMin & closestToMedianImage and compare those with the bands in the list of images in ImageCollection: True Color (432) and the median image.
I will be waiting to hear back from you. Thanks Again!
Thank you so much for developing the amazing tool in GEE. I found that medoid method was applied to create yearly landsat composite (article link). I found the relevant codes in GEE for this operation (medoid method):
Here,
.reduce(ee.Reducer.min(7)
gave me output with the lowest value of the pixels rather than the closest value to the median. I am not so sure through, this may lead to the inappropriate result. Could you please confirm that the tool actually used medoid method to prepare yearly single image? I will be very grateful for that. I might be wrong. If so, please accept my apologies and let me know why it is alright. Thank you so much! I will be looking forward to your kind response.