ee.Dictionary.combine

दो डिक्शनरी को जोड़ता है. डुप्लीकेट नामों के मामले में, आउटपुट में दूसरी डिक्शनरी की वैल्यू शामिल होगी. हालांकि, ऐसा तब होगा, जब ओवरराइट करने की सुविधा बंद हो. दोनों डिक्शनरी में मौजूद शून्य वैल्यू को अनदेखा किया जाता है / हटा दिया जाता है.

इस्तेमालरिटर्न
Dictionary.combine(second, overwrite)शब्दकोश
आर्ग्यूमेंटटाइपविवरण
यह: firstशब्दकोश
secondशब्दकोश
overwriteबूलियन, डिफ़ॉल्ट: true

उदाहरण

कोड एडिटर (JavaScript)

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

// A second dictionary.
var dict2 = ee.Dictionary({
  Region: 'The Forest of Nisene Marks State Park',
  Image: 'Sentinel-2 surface reflectance (scaled by 1e4)',
  B1: -9999  // Note that the B1 key is present in both dictionaries.
});

print('Combined dictionaries (overwrite false)',
      dict1.combine(dict2, false));

print('Combined dictionaries (overwrite true)',
      dict1.combine(dict2, true));

Python सेटअप करना

Python API और इंटरैक्टिव डेवलपमेंट के लिए geemap का इस्तेमाल करने के बारे में जानकारी पाने के लिए, Python एनवायरमेंट पेज देखें.

import ee
import geemap.core as geemap

Colab (Python)

import pprint

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

# A second dictionary.
dic_2 = ee.Dictionary({
    'Region': 'The Forest of Nisene Marks State Park',
    'Image': 'Sentinel-2 surface reflectance (scaled by 1e4)',
    'B1': -9999  # Note that the B1 key is present in both dictionaries.
})

print('Combined dictionaries (overwrite false)')
pprint.pprint(dic_1.combine(dic_2, False).getInfo())

print('\nCombined dictionaries (overwrite true)')
pprint.pprint(dic_1.combine(dic_2, True).getInfo())