إشعار: يجب
إثبات أهلية جميع المشاريع غير التجارية المسجّلة لاستخدام Earth Engine قبل
15 أبريل 2025 من أجل الحفاظ على إمكانية الوصول إلى Earth Engine.
ee.Dictionary.set
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
ضبط قيمة في قاموس
الاستخدام | المرتجعات |
---|
Dictionary.set(key, value) | القاموس |
الوسيطة | النوع | التفاصيل |
---|
هذا: dictionary | القاموس | |
key | سلسلة | |
value | عنصر | |
أمثلة
محرّر الرموز البرمجية (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('Set value for B3 key as -9999', dict.set('B3', -9999));
إعداد Python
راجِع صفحة
بيئة Python للحصول على معلومات حول واجهة برمجة التطبيقات Python واستخدام
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('Set value for B3 key as -9999:', dic.set('B3', -9999).getInfo())
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThe \u003ccode\u003eDictionary.set\u003c/code\u003e method is used to assign a new value to a specified key within an existing Earth Engine dictionary.\u003c/p\u003e\n"],["\u003cp\u003eIt accepts the dictionary, the key to be updated, and the new value as arguments.\u003c/p\u003e\n"],["\u003cp\u003eThe method returns a new dictionary with the updated key-value pair, leaving the original dictionary unchanged.\u003c/p\u003e\n"],["\u003cp\u003eThis functionality is useful for modifying data within Earth Engine dictionaries, like those containing image band values or other geospatial information.\u003c/p\u003e\n"]]],["The `Dictionary.set(key, value)` method modifies a dictionary by assigning a new value to a specified key. It takes a dictionary, a string `key`, and an `object` value as arguments, and returns the modified dictionary. The examples demonstrate setting the value of the 'B3' key to -9999 within dictionaries, using both JavaScript and Python. The key should be a String, and the value can be any object.\n"],null,["# ee.Dictionary.set\n\nSet a value in a dictionary.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|------------------------------|------------|\n| Dictionary.set`(key, value)` | Dictionary |\n\n| Argument | Type | Details |\n|--------------------|------------|---------|\n| this: `dictionary` | Dictionary | |\n| `key` | String | |\n| `value` | Object | |\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 dict = ee.Dictionary({\n B1: 182,\n B2: 219,\n B3: 443\n});\n\nprint('Set value for B3 key as -9999', dict.set('B3', -9999));\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\n# A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).\ndic = ee.Dictionary({\n 'B1': 182,\n 'B2': 219,\n 'B3': 443\n})\n\nprint('Set value for B3 key as -9999:', dic.set('B3', -9999).getInfo())\n```"]]