I have 4 different image collections and I am trying to merge them into a single collection. Further I want to mosaic them based on the date of acquisition.
I tried this code,
var Res_collection = rescaled_129.merge(rescaled_136);
Res_collection = Res_collection.merge(rescaled_27);
Res_collection = Res_collection.merge(rescaled_63);
print(Res_collection);
var start = ee.Date(start_date);
var finish = ee.Date(end_date);
// Difference in days between start and finish
var diff = finish.difference(start, 'day');
// Make a list of all dates
var range = ee.List.sequence(0, diff.subtract(1)).map(function(day){return start.advance(day,'day')});
// Funtion for iteraton over the range of dates
var day_mosaics = function(date, newlist) {
// Cast
date = ee.Date(date);
newlist = ee.List(newlist);
// Filter collection between date and the next day
var filtered = Res_collection.filterDate(date, date.advance(1,'day'));
// Make the mosaic
var image = ee.Image(filtered.mosaic()).set('system:time_start',filtered.get('system:time_start'));
// Add the mosaic to a list only if the collection has images
return ee.List(ee.Algorithms.If(filtered.size(), newlist.add(image), newlist));
};
// Iterate over the range to make a new list, and then cast the list to an imagecollection
var newcol = ee.ImageCollection(ee.List(range.iterate(day_mosaics, ee.List([]))));
print('Mosaic', newcol);
Here I get 0 elements in the output image collection.
I also tried using the following code,
var Res_collection1 = rescaled_129.merge(rescaled_136).copyProperties(rescaled_129);
print(Res_collection1);
var Res_collection2 = rescaled_27.merge(rescaled_63).copyProperties(rescaled_27);
print(Res_collection2);
var Res_collection = Res_collection1.merge(Res_collection2).copyProperties(Res_collection1);
print(Res_collection);
For the third merge I am getting this error: Res_collection1.merge is not a function
It would be really helpful if there is some way to sort it out.
Here is the link to the code: https://code.earthengine.google.co.in/?scriptPath=users%2Frchandraprabha15%2FSnowDepth%3ASentinel1_Snow%20depth