0

I want to calculate the column mean of the following set of data as the result of 1 row and 7 columns.

Which functions should I use in Google Earth Engine or should I write an extra function?

var data=[['1','2','3','4','5','6','7'],
              ['8','9','10','11','12','13','14'],            
       ['15','16','17','18','19','20','21']];

1 Answer 1

2

One way is:

var data=ee.Array([[1,2,3,4,5,6,7], [8,9,10,11,12,13,14],
[15,16,17,18,19,20,21]]);

var data2 = data.transpose().toList();
print(data2)

var mean = data2.map(function(lis) {
  return ee.List(lis).reduce(ee.Reducer.mean());
});
print(mean)
0

Your Answer

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

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