公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ee.Reducer.forEachElement
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
分别缩减形状相同的数组输入中的每个位置,生成形状相同的数组输出。
例如,如果将“sum”缩减器应用于 5 个形状为 2x2 的数组,输出将是一个 2x2 的数组,其中每个位置的值都是相应位置上 5 个值的总和。
用法 | 返回 |
---|
Reducer.forEachElement() | 缩减器 |
参数 | 类型 | 详细信息 |
---|
此:reducer | 缩减器 | 要应用于每个数组元素的缩减器。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eApplies a reducer function to corresponding elements across multiple arrays of the same shape.\u003c/p\u003e\n"],["\u003cp\u003eOutputs a single array mirroring the input shape, with each element representing the reduced value of corresponding input elements.\u003c/p\u003e\n"],["\u003cp\u003eOffers flexibility through the \u003ccode\u003eforEachElement\u003c/code\u003e method to specify the reducer function.\u003c/p\u003e\n"],["\u003cp\u003eIllustrated with an example using the 'sum' reducer to aggregate values across five 2x2 arrays into a resultant 2x2 array.\u003c/p\u003e\n"]]],[],null,["# ee.Reducer.forEachElement\n\nSeparately reduces each position in array inputs of equal shape, producing an array output of the same shape.\n\n\u003cbr /\u003e\n\nFor example, with the 'sum' reducer applied to 5 arrays with shape 2x2, the output will be a 2x2 array, where each position is the sum of the 5 values at that position.\n\n| Usage | Returns |\n|----------------------------|---------|\n| Reducer.forEachElement`()` | Reducer |\n\n| Argument | Type | Details |\n|-----------------|---------|---------------------------------------------|\n| this: `reducer` | Reducer | The reducer to apply to each array element. |"]]