I am having two image collections, sc, data(Sentinel 1 data).

I need to do an iterative type of computation where I need to use previous output for the next iteration and also multiple images using two different index for computation.

This is the algorithm that I need to perform.

enter image description here

SC and the backscatter values are present in the image collection. A change detection index (SI) needs to be calculated for each location i and time step t.

I tried to perform using the following code and I am getting this error.

var i = data.size();
var e = i.subtract(2);
var co = ee.List.sequence(0, e);
print("list", co);

//Calculating snow index

var si_1 = ee.Image(0).expression(
     '(VH/VV)*SC', {
       'VV': ee.Image(data.toList(data.size()).get(0)).select('VV_1'),
       'VH': ee.Image(data.toList(data.size()).get(0)).select('VH_1'),
       'SC': ee.Image(sc.toList(sc.size()).get(0)).select(0)

var si_2 = ee.Image(0).expression(
     '(SI + (VH/VV) - (VHp/VVp))*SC', {
        'VV': ee.Image(data.toList(data.size()).get(1)).select('VV_1'),
        'VH': ee.Image(data.toList(data.size()).get(1)).select('VH_1'),
        'VVp': ee.Image(data.toList(data.size()).get(0)).select('VV_1'),
        'VHp': ee.Image(data.toList(data.size()).get(0)).select('VH_1'),
        'SI': ee.Image(si_1),
        'SC': ee.Image(sc.toList(sc.size()).get(1)).select(0)

var si = ee.ImageCollection.fromImages([si_1, si_2]);
print('SI_1', si);

// Funtion for iteraton over the image collection to compute Snow Index
var Snow_index = function(is, newlist) {
is = ee.Number(is);
var is_ = is.add(1);
newlist = ee.List(newlist);

var si_ = ee.List(ee.Image(0).expression(
   '(SI + (VH/VV) - (VHp/VVp))*SC', {
       'VV': ee.Image(data.toList(data.size()).get(is_)).select('VV_1'),
       'VH': ee.Image(data.toList(data.size()).get(is_)).select('VH_1'),
       'VVp': ee.Image(data.toList(data.size()).get(is)).select('VV_1'),
       'VHp': ee.Image(data.toList(data.size()).get(is)).select('VH_1'),
       'SI': ee.Image(si.toList(si.size()).get(is)).select(0),
       'SC': ee.Image(sc.toList(sc.size()).get(is_)).select(0)

// Add the SI to a list
return ee.List(ee.List(newlist).add(si_))

Error: List (Error) List.add, argument 'list': Invalid type. Expected type: List. Actual type: ImageCollection.

It would be really helpful if someone could help me sort it out.

Link to the code: https://code.earthengine.google.com/8b423c3909b152beb985a806c169b432

  • Do you mind sharing the article where you picked up the formula? I'm having trouble following your code, the article might make that a bit easier. Commented May 31, 2022 at 14:28
  • Snow depth variability in the Northern Hemisphere mountains observed from space by Lievens et al(2019) Commented Jun 6, 2022 at 18:17

1 Answer 1


Looking at your code, you can easily resolve your error by changing the syntax at line 218 from

var si = ee.ImageCollection(ee.List(co.iterate(Snow_index, ee.List(si))))


var si = ee.ImageCollection(ee.List(co.iterate(Snow_index, si.toList(si.size()))))

However this brings out a new problem in your code:

enter image description here

From what I can tell, it is because you list 'co' has 4 elements though your list 'si' only has two images. This however is beyond the scope of this question so I won't be investigating further.

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.