I have missing dates with no data which I want to create data for using linear interpolation. I have been attempting a few things with little success. Most examples create a masked layer and replace the masked values but I don't know how to create a masked layer in this scenario. Any advise greatly appreciated
var roi = ee.Geometry.Rectangle([26, -24, 29, -27]); // Import and filter dataset var collection_GRACE = ee.ImageCollection('NASA/GRACE/MASS_GRIDS/LAND') .filterBounds(roi) .filter(ee.Filter.date('2002-01-01', '2016-12-31')) .map(function(image){return image.clip(roi)}) .select('lwe_thickness_csr'); // Print list of dates for which data is available function ymdList(collection_GRACE){ 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 collection_GRACE.iterate(iter_func, ee.List([])); } print(ymdList(collection_GRACE)); // Replace masked pixels by the mean of the previous and next months var interpolated = collection_GRACE.map(function(image){ var currentDate = ee.Date(image.date().format("YYYYMMdd")); var meanImage = collection_GRACE.filterDate( currentDate.advance(-2, 'month'), currentDate.advance(2, 'month')).mean(); // replace all masked values: return meanImage.where(image, image); }); Map.addLayer(interpolated,{},'interpolated');