2

How can we apply more than 2 reducers to an Image?

The following link shows for 2 reducers https://developers.google.com/earth-engine/reducers_intro

But the following won't work:

// Load a Landsat 8 image.
var image = ee.Image('LANDSAT/LC08/C01/T1/LC08_044034_20140318');

// Combine the mean and standard deviation reducers.
var reducers = ee.Reducer.mean().combine({
  reducer2: ee.Reducer.stdDev(),
  reducer3: ee.Reducer.max(),
  sharedInputs: true
});

// Use the combined reducer to get
var stats = image.reduceRegion({
  reducer: reducers,
  bestEffort: true,
});

print(stats);
2

combine always combines two reducers, but you can combine a combination with another reducer. So, modify your script like so:

var reducers = ee.Reducer.mean().combine({
  reducer2: ee.Reducer.stdDev(),
  sharedInputs: true
}).combine({
  reducer2: ee.Reducer.max(),
  sharedInputs: true
});

to get:

B1_max: 23368
B1_mean: 9349.846011975142
B1_stdDev: 536.665332450372
B2_max: 24768
B2_mean: 8545.12421443731
B2_stdDev: 661.2107158731956
...
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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