ee.Array.first

要素ごとに、最初の値の値を選択します。

用途戻り値
Array.first(right)配列
引数タイプ詳細
これ: left配列左側の値。
right配列右側の値。

コードエディタ(JavaScript)

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

print(ee.Array([0]).first(0));  // [0]
print(ee.Array([0, 1, 2]).first(1));  // [0,1,2]
print(ee.Array([0, 1, 2]).first(ee.Array([3, 4, 5])));  // [0,1,2]
print(ee.Array([3, 4, 5]).first(ee.Array([0, 1, 2])));  // [3,4,5]

Python の設定

Python API とインタラクティブな開発での geemap の使用については、 Python 環境のページをご覧ください。

import ee
import geemap.core as geemap

Colab(Python)

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

display(ee.Array([0]).first(0))  # [0]
display(ee.Array([0, 1, 2]).first(1))  # [0,1,2]
display(ee.Array([0, 1, 2]).first(ee.Array([3, 4, 5])))  # [0, 1, 2]
display(ee.Array([3, 4, 5]).first(ee.Array([0, 1, 2])))  # [3, 4, 5]