I'm attempting to run a function to automate the gap filling of nodata values in several imageCollections using focal mean, but somewhere I've taken the incorrect route. Need some help.

Map.centerObject(chora, 11)

var bess =  = ee.ImageCollection("SNU/ESL/BESS/Rad/v1");
var aod = ee.ImageCollection("MODIS/006/MCD19A2_GRANULES");
var ndwi = ee.ImageCollection("MODIS/MYD09GA_006_NDWI");

var vari = bess.select('RSDN_Daily').filterDate('2021-01-01', '2021-12-31');

function fill(image){
  ima = image.focal_mean(1, 'square', 'pixels', 20)
  imei = ima.blend(image)
  image = imei
  return image


1 Answer 1


You want to invoke fill() for every image in your vari collection, as apposed to passing the whole collection to fill(). You use map() for that.

var filled = vari.map(fill)


Your Answer

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

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