I have two image collections with 14 images each. I need to subtract the first image of the first collection to the first image of the second collection, the second image of the first collection to the second image of the second collection and so on, until the last image. My aim is to create a new image collection which contains the result of this subtraction. With zip I get a list of two elements list.

var coll = coll_GEE.toList(14).zip(coll_SNAP.toList(14))

Is it possible to apply a function like this to every sublist of the list, avoiding a for cycle?

var subtract = function (list){
     var GEE = ee.Image(list.get(0))
     var SNAP = ee.Image (list.get(1))
     var subt = SNAP.subtract(GEE)
     return subt};

I read the list.map(baseAlgorithm, dropNulls) can only return a object.

  • In your case I think I'd try to combine() the two image collections and then map a function to return the difference of each image; return im.select(0).subtract(im.select(1)).
    – Kevin
    Sep 7, 2021 at 21:06


Your Answer

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

Browse other questions tagged or ask your own question.