ee.Dictionary.getNumber

從字典中擷取具名數字值。

用量傳回
Dictionary.getNumber(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
});

print('The "B1" value as an ee.Number object', dict.getNumber('B1'));

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
})

print('The "B1" value as an ee.Number object:', dic.getNumber('B1').getInfo())