ee.Dictionary.getArray

從字典中擷取具名陣列值。

用量傳回
Dictionary.getArray(key)陣列
引數類型詳細資料
這個:dictionary字典
key字串

範例

程式碼編輯器 (JavaScript)

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

print('The "Array" value as an ee.Array object', dict.getArray('Array'));

Python 設定

請參閱 Python 環境頁面,瞭解 Python API 和如何使用 geemap 進行互動式開發。

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,
    'Array': ee.Array([182, 219, 443])
})

print('The "Array" value as an ee.Array object:',
      dic.getArray('Array').getInfo())