ee.Dictionary.toArray

辞書の数値を配列として返します。キーが指定されていない場合は、辞書のキーの自然な順序ですべての値が返されます。デフォルトの「axis」は 0 です。

用途戻り値
Dictionary.toArray(keys, axis)配列
引数タイプ詳細
これ: dictionaryDictionary
keysリスト、デフォルト: null
axis整数、デフォルト: 0

コードエディタ(JavaScript)

// A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
var dict = ee.Dictionary({
  B1: 182,
  B2: 219,
  B3: 443
});

print('Values for selected keys converted to ee.Array',
      dict.toArray(['B1', 'B2']));
print('Values for all keys converted to ee.Array',
      dict.toArray());

Python の設定

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

import ee
import geemap.core as geemap

Colab(Python)

# A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
dic = ee.Dictionary({
    'B1': 182,
    'B2': 219,
    'B3': 443
})

print('Values for selected keys converted to ee.Array:',
      dic.toArray(['B1', 'B2']).getInfo())
print('Values for all keys converted to ee.Array:',
      dic.toArray().getInfo())