ee.Array.subtract

按元素逐个从第一个值中减去第二个值。

用法返回
Array.subtract(right)数组
参数类型详细信息
此:left数组左侧值。
right数组右侧值。

示例

代码编辑器 (JavaScript)

print(ee.Array([10]).subtract(1));  // [9]

print(ee.Array([-1, 0, 1]).subtract(2));  // [-3,-2,-1]
print(ee.Array([-1, 0, 1]).subtract([-5, 6, 7]));  // [4,-6,-6]

var empty = ee.Array([], ee.PixelType.int8());
print(empty.subtract(empty));  // []

Python 设置

如需了解 Python API 和如何使用 geemap 进行交互式开发,请参阅 Python 环境页面。

import ee
import geemap.core as geemap

Colab (Python)

display(ee.Array([10]).subtract(1))  # [9]

display(ee.Array([-1, 0, 1]).subtract(2))  # [-3, -2, -1]
display(ee.Array([-1, 0, 1]).subtract([-5, 6, 7]))  # [4, -6, -6]

empty = ee.Array([], ee.PixelType.int8())
display(empty.subtract(empty))  # []