ee.Dictionary.getNumber

Trích xuất một giá trị số có tên từ một từ điển.

Cách sử dụngGiá trị trả về
Dictionary.getNumber(key)Số
Đối sốLoạiThông tin chi tiết
this: dictionaryTừ điển
keyChuỗi

Ví dụ

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

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)

# 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())