ee.Array.subtract

Theo từng phần tử, trừ giá trị thứ hai cho giá trị đầu tiên.

Cách sử dụngGiá trị trả về
Array.subtract(right)Mảng
Đối sốLoạiThông tin chi tiết
this: leftMảngGiá trị bên trái.
rightMảngGiá trị bên phải.

Ví dụ

Trình soạn thảo mã (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));  // []

Thiết lập Python

Hãy xem trang Môi trường Python để biết thông tin về API Python và cách sử dụng geemap cho quá trình phát triển tương tác.

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))  # []