如何通过 Google Earth Engine 中的数字匹配条件来减少图像集合

How to reduce an image collection by numbers matching conditions in Google Earth Engine

有没有办法减少图像集的数量,有多少图像匹配条件?

例如,我想创建一个新图像来可视化一段时间内有多少天满足某些条件。

当您想要通过以某种方式为每个空间位置组合所有像素来将图像集合转换为图像时,解决方案是 ImageCollection.reduce。在这种情况下,我们可以使用 ee.Reducer.count reducer 来统计满足条件的像素数。

JavaScript 示例:

var daysMeetingConditionImage = imageCollectionOfDayImages
  .map(function (image) {
    // Apply the condition, whatever it is, as a mask.
    // Masked-off pixels will not be counted.
    return image.updateMask(
       image.select('B2').gt(7)  // Change this to whatever your per-pixel condition is
    );
  })
  .reduce(ee.Reducer.count());