ee.Dictionary.get

একটি অভিধান থেকে একটি নামযুক্ত মান বের করে। যদি অভিধানে প্রদত্ত কী না থাকে, তাহলে ডিফল্ট ভ্যালু ফেরত দেওয়া হয়, যদি না এটি শূন্য হয়।

ব্যবহার রিটার্নস
Dictionary. get (key, defaultValue ) অবজেক্ট
যুক্তি টাইপ বিস্তারিত
এই: dictionary অভিধান
key স্ট্রিং
defaultValue অবজেক্ট, ডিফল্ট: নাল

উদাহরণ

কোড এডিটর (জাভাস্ক্রিপ্ট)

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

print('Value for "B1" key', dict.get('B1'));

// Set a default value for the case where the key does not exist.
print('Value for nonexistent "Band_1" key',
      dict.get({key: 'Band_1', defaultValue: -9999}));

পাইথন সেটআপ

পাইথন এপিআই এবং ইন্টারেক্টিভ ডেভেলপমেন্টের জন্য geemap ব্যবহার করার জন্য পাইথন এনভায়রনমেন্ট পৃষ্ঠাটি দেখুন।

import ee
import geemap.core as geemap

Colab (পাইথন)

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

print('Value for "B1" key:', dic.get('B1').getInfo())

# Set a default value for the case where the key does not exist.
print('Value for nonexistent "Band_1" key:',
      dic.get(**{'key': 'Band_1', 'defaultValue': -9999}).getInfo())