ee.Dictionary.combine
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
دو فرهنگ لغت را ترکیب می کند. در مورد نامهای تکراری، خروجی حاوی مقدار فرهنگ لغت دوم خواهد بود، مگر اینکه رونویسی نادرست باشد. مقادیر تهی در هر دو فرهنگ لغت نادیده گرفته می شوند / حذف می شوند.
استفاده | برمی گرداند | Dictionary. combine (second, overwrite ) | فرهنگ لغت |
استدلال | تایپ کنید | جزئیات | این: first | فرهنگ لغت | |
second | فرهنگ لغت | |
overwrite | بولی، پیش فرض: درست است | |
نمونه ها
ویرایشگر کد (جاوا اسکریپت)
// 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));
راه اندازی پایتون
برای اطلاعات در مورد API پایتون و استفاده از geemap
برای توسعه تعاملی به صفحه محیط پایتون مراجعه کنید.
import ee
import geemap.core as geemap
کولب (پایتون)
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())
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003e\u003ccode\u003eDictionary.combine()\u003c/code\u003e merges two dictionaries into a single dictionary.\u003c/p\u003e\n"],["\u003cp\u003eIf the same key exists in both dictionaries, the value from the second dictionary is used by default, unless \u003ccode\u003eoverwrite\u003c/code\u003e is set to \u003ccode\u003efalse\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eNull values present in either of the input dictionaries are automatically excluded from the final combined dictionary.\u003c/p\u003e\n"],["\u003cp\u003eIt's accessible in both JavaScript and Python environments within the Earth Engine platform.\u003c/p\u003e\n"]]],[],null,["# ee.Dictionary.combine\n\nCombines two dictionaries. In the case of duplicate names, the output will contain the value of the second dictionary unless overwrite is false. Null values in both dictionaries are ignored / removed.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|---------------------------------------------|------------|\n| Dictionary.combine`(second, `*overwrite*`)` | Dictionary |\n\n| Argument | Type | Details |\n|---------------|------------------------|---------|\n| this: `first` | Dictionary | |\n| `second` | Dictionary | |\n| `overwrite` | Boolean, default: true | |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).\nvar dict1 = ee.Dictionary({\n B1: 182,\n B2: 219,\n B3: 443\n});\n\n// A second dictionary.\nvar dict2 = ee.Dictionary({\n Region: 'The Forest of Nisene Marks State Park',\n Image: 'Sentinel-2 surface reflectance (scaled by 1e4)',\n B1: -9999 // Note that the B1 key is present in both dictionaries.\n});\n\nprint('Combined dictionaries (overwrite false)',\n dict1.combine(dict2, false));\n\nprint('Combined dictionaries (overwrite true)',\n dict1.combine(dict2, true));\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\nimport pprint\n\n# A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).\ndic_1 = ee.Dictionary({\n 'B1': 182,\n 'B2': 219,\n 'B3': 443\n})\n\n# A second dictionary.\ndic_2 = ee.Dictionary({\n 'Region': 'The Forest of Nisene Marks State Park',\n 'Image': 'Sentinel-2 surface reflectance (scaled by 1e4)',\n 'B1': -9999 # Note that the B1 key is present in both dictionaries.\n})\n\nprint('Combined dictionaries (overwrite false)')\npprint.pprint(dic_1.combine(dic_2, False).getInfo())\n\nprint('\\nCombined dictionaries (overwrite true)')\npprint.pprint(dic_1.combine(dic_2, True).getInfo())\n```"]]