إشعار: يجب
إثبات أهلية جميع المشاريع غير التجارية المسجّلة لاستخدام Earth Engine قبل
15 أبريل 2025 من أجل الحفاظ على إمكانية الوصول إلى Earth Engine.
نظرة عامة على أداة تقليل البيانات
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
أدوات التقليل هي طريقة تجميع البيانات بمرور الوقت والمساحة والشرائح والصفائف وغيرها من ملفوظات
البيانات في Earth Engine. تحدِّد فئة ee.Reducer
كيفية
تجميع البيانات. يمكن للعوامل المُخفِّضة في هذه الفئة تحديد إحصاءات بسيطة لاستخدامها في عملية
التجميع (مثل الحد الأدنى أو الحد الأقصى أو المتوسط أو المتوسط الحسابي أو الانحراف المعياري أو غير ذلك)، أو مزيد من الصعوبة
في تلخيص بيانات الإدخال (مثل الرسم البياني الشريطي أو الانحدار الخطي أو القائمة). قد تحدث التخفيضات على مدار
الوقت (imageCollection.reduce()
) أو المساحة (image.reduceRegion()
image.reduceNeighborhood()
) أو النطاقات (image.reduce()
) أو
مساحة السمة الخاصة بـ FeatureCollection
(featureCollection.reduceColumns()
أو طرق FeatureCollection
التي تبدأ بـ aggregate_
).
تأخذ دالات التجميع مجموعة بيانات إدخال وتُنشئ ناتجًا واحدًا. عند تطبيق مُخفِّض إدخال واحد
على صورة متعددة النطاقات، يُكرِّر Earth Engine المُخفِّض تلقائيًا ويطبِّقه
بشكل منفصل على كل نطاق. ونتيجةً لذلك، تحتوي الصورة الناتجة على العدد نفسه من النطاقات مثل
الصورة المُدخلة، وكل نطاق في الناتج هو تقليل عدد البكسل من النطاق المقابل في
بيانات الإدخال. تأخذ بعض وظائف التقليل مجموعات من مجموعات بيانات الإدخال. ولن تتم إعادة برمجة هذه المُخفِّضات
تلقائيًا لكل نطاق. على سبيل المثال، تأخذ دالة
ee.Reducer.LinearRegression()
مجموعات بيانات متعددة تتضمّن عوامل تنبؤ (تمثّل
المتغيّرات المستقلة في الانحدار) بترتيب معيّن (راجِع
مُخفِّضات الانحدار).
تُنشئ بعض أدوات التقليل نتائج متعددة، مثل ee.Reducer.minMax()
أو
ee.Reducer.histogram()
أو ee.Reducer.toList()
. على سبيل المثال:
محرِّر الرموز البرمجية (JavaScript)
// Load and filter the Sentinel-2 image collection.
var collection = ee.ImageCollection('COPERNICUS/S2_HARMONIZED')
.filterDate('2016-01-01', '2016-12-31')
.filterBounds(ee.Geometry.Point([-81.31, 29.90]));
// Reduce the collection.
var extrema = collection.reduce(ee.Reducer.minMax());
إعداد لغة Python
اطّلِع على صفحة
بيئة Python للحصول على معلومات عن واجهة برمجة التطبيقات Python API واستخدام IDE
geemap
لتطوير التطبيقات التفاعلي.
import ee
import geemap.core as geemap
Colab (Python)
# Load and filter the Sentinel-2 image collection.
collection = (
ee.ImageCollection('COPERNICUS/S2_HARMONIZED')
.filterDate('2016-01-01', '2016-12-31')
.filterBounds(ee.Geometry.Point([-81.31, 29.90]))
)
# Reduce the collection.
extrema = collection.reduce(ee.Reducer.minMax())
سيؤدي ذلك إلى إنشاء إخراج يتضمّن ضعف عدد نطاقات الإدخال، حيث يتم إلحاق "_min" أو "_max" باسم النطاق في
الإخراج.
يجب أن يتطابق نوع الإخراج مع الحساب. على سبيل المثال، ينتج عن المُخفِّض الذي يتم تطبيقه على
ImageCollection
ناتج Image
. وبما أنّ الإخراج
يتم تفسيره كقيمة بكسل، يجب استخدام عوامل التخفيض التي لها إخراج رقمي لتقليل
ImageCollection
(لن تعمل عوامل التخفيض مثل toList()
أو
histogram()
).
يتمّ تلقائيًا منح وزن للتخفيضات على قيم البكسل حسب قناعها، إلا أنّه يمكن
تغيير هذا السلوك (راجِع قسم "التقييم"). لن يتم استخدام وحدات البكسل التي تكون فيها قيمة القناع
مساوية لـ 0 في عملية التصغير.
دمج أدوات تقليل البيانات
إذا كنت تريد تطبيق عدّة أدوات تقليل على الإدخالات نفسها، من الممارسات الجيدة
combine()
أدوات التقليل لتحقيق الكفاءة. على وجه التحديد، سيؤدي استدعاء
combine()
على مُخفِّض تم ضبط sharedInputs
فيه على
true
إلى إجراء جولة واحدة فقط على البيانات. على سبيل المثال، لاحتساب
المتوسط والانحراف المعياري للبكسل في صورة، يمكنك استخدام ما يلي:
محرِّر الرموز البرمجية (JavaScript)
// Load a Landsat 8 image.
var image = ee.Image('LANDSAT/LC08/C02/T1/LC08_044034_20140318');
// Combine the mean and standard deviation reducers.
var reducers = ee.Reducer.mean().combine({
reducer2: ee.Reducer.stdDev(),
sharedInputs: true
});
// Use the combined reducer to get the mean and SD of the image.
var stats = image.reduceRegion({
reducer: reducers,
bestEffort: true,
});
// Display the dictionary of band means and SDs.
print(stats);
إعداد لغة Python
اطّلِع على صفحة
بيئة Python للحصول على معلومات عن واجهة برمجة التطبيقات Python API واستخدام IDE
geemap
لتطوير التطبيقات التفاعلي.
import ee
import geemap.core as geemap
Colab (Python)
# Load a Landsat 8 image.
image = ee.Image('LANDSAT/LC08/C02/T1/LC08_044034_20140318')
# Combine the mean and standard deviation reducers.
reducers = ee.Reducer.mean().combine(
reducer2=ee.Reducer.stdDev(), sharedInputs=True
)
# Use the combined reducer to get the mean and SD of the image.
stats = image.reduceRegion(reducer=reducers, bestEffort=True)
# Display the dictionary of band means and SDs.
display(stats)
في الإخراج، يُرجى ملاحظة أنّه تم إلحاق أسماء المُختزلِين بأسماء
المدخلات لتمييز نواتج المُختزلِين. ينطبق هذا السلوك أيضًا على نواتج الصور التي
سيتم إلحاق اسم المُخفِّض بأسماء نطاقات الإخراج.
في حال كنت تجمع بين مُخفِّضات تستخدم مدخلات غير مرجحة ومُخفِّضات تستخدم مدخلات مرجحة، يجب أن تكون كل المدخلات المرجحة قبل كل المدخلات غير المرجحة.
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eReducers in Earth Engine aggregate data over time, space, bands, arrays, and other data structures, using methods like \u003ccode\u003ereduceRegion()\u003c/code\u003e and \u003ccode\u003ereduce()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eReducers can calculate simple statistics (e.g., mean, minimum) or more complex summaries (e.g., histograms, linear regressions) on images, image collections, and feature collections.\u003c/p\u003e\n"],["\u003cp\u003eWhen applied to multi-band images, single input reducers are automatically applied to each band, producing an output with the same number of bands.\u003c/p\u003e\n"],["\u003cp\u003eReducers can be combined using \u003ccode\u003ecombine()\u003c/code\u003e for efficient processing, allowing multiple calculations in a single pass over the data.\u003c/p\u003e\n"],["\u003cp\u003eBy default, pixel values in reductions are weighted by their mask, meaning pixels with a mask of 0 are excluded from the calculation.\u003c/p\u003e\n"]]],[],null,["# Reducer Overview\n\nReducers are the way to aggregate data over time, space, bands, arrays and other data\nstructures in Earth Engine. The `ee.Reducer` class specifies how data is\naggregated. The reducers in this class can specify a simple statistic to use for the\naggregation (e.g. minimum, maximum, mean, median, standard deviation, etc.), or a more complex\nsummary of the input data (e.g. histogram, linear regression, list). Reductions may occur over\ntime (`imageCollection.reduce()`), space (`image.reduceRegion()`,\n`image.reduceNeighborhood()`), bands (`image.reduce()`), or the\nattribute space of a `FeatureCollection` (`featureCollection.reduceColumns()`\nor `FeatureCollection` methods that start with `aggregate_`).\n\nReducers have inputs and outputs\n--------------------------------\n\n\nReducers take an input dataset and produce a single output. When a single input reducer is\napplied to a multi-band image, Earth Engine automatically replicates the reducer and applies\nit separately to each band. As a result, the output image has the same number of bands as the\ninput image; each band in the output is the reduction of pixels from the corresponding band in\nthe input data. Some reducers take tuples of input datasets. These reducers will not be\nautomatically replicated for each band. For example,\n`ee.Reducer.LinearRegression()` takes multiple predictor datasets (representing\nindependent variables in the regression) in a particular order (see\n[Regression reducers](/earth-engine/guides/reducers_regression)).\n\n\nSome reducers produce multiple outputs, for example `ee.Reducer.minMax()`,\n`ee.Reducer.histogram()` or `ee.Reducer.toList()`. For example:\n\n### Code Editor (JavaScript)\n\n```javascript\n// Load and filter the Sentinel-2 image collection.\nvar collection = ee.ImageCollection('COPERNICUS/S2_HARMONIZED')\n .filterDate('2016-01-01', '2016-12-31')\n .filterBounds(ee.Geometry.Point([-81.31, 29.90]));\n\n// Reduce the collection.\nvar extrema = collection.reduce(ee.Reducer.minMax());\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# Load and filter the Sentinel-2 image collection.\ncollection = (\n ee.ImageCollection('COPERNICUS/S2_HARMONIZED')\n .filterDate('2016-01-01', '2016-12-31')\n .filterBounds(ee.Geometry.Point([-81.31, 29.90]))\n)\n\n# Reduce the collection.\nextrema = collection.reduce(ee.Reducer.minMax())\n```\n\n\nThis will produce an output with twice the number of bands of the inputs, where band names in\nthe output have '_min' or '_max' appended to the band name.\n\n\nThe output type should match the computation. For example, a reducer applied to an\n`ImageCollection` has an `Image` output. Because the output is\ninterpreted as a pixel value, you must use reducers with a numeric output to reduce an\n`ImageCollection` (reducers like `toList()` or\n`histogram()` won't work).\n\nReducers use weighted inputs\n----------------------------\n\n\nBy default, reductions over pixel values are weighted by their mask, though this behavior can\nbe changed (see the [Weighting section](/earth-engine/guides/reducers_weighting)). Pixels with mask\nequal to 0 will not be used in the reduction.\n\nCombining reducers\n------------------\n\n\nIf your intent is to apply multiple reducers to the same inputs, it's good practice to\n`combine()` the reducers for efficiency. Specifically, calling\n`combine()` on a reducer with `sharedInputs` set to\n`true` will result in only a single pass over the data. For example, to compute the\nmean and standard deviation of pixels in an image, you could use something like this:\n\n### Code Editor (JavaScript)\n\n```javascript\n// Load a Landsat 8 image.\nvar image = ee.Image('LANDSAT/LC08/C02/T1/LC08_044034_20140318');\n\n// Combine the mean and standard deviation reducers.\nvar reducers = ee.Reducer.mean().combine({\n reducer2: ee.Reducer.stdDev(),\n sharedInputs: true\n});\n\n// Use the combined reducer to get the mean and SD of the image.\nvar stats = image.reduceRegion({\n reducer: reducers,\n bestEffort: true,\n});\n\n// Display the dictionary of band means and SDs.\nprint(stats);\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# Load a Landsat 8 image.\nimage = ee.Image('LANDSAT/LC08/C02/T1/LC08_044034_20140318')\n\n# Combine the mean and standard deviation reducers.\nreducers = ee.Reducer.mean().combine(\n reducer2=ee.Reducer.stdDev(), sharedInputs=True\n)\n\n# Use the combined reducer to get the mean and SD of the image.\nstats = image.reduceRegion(reducer=reducers, bestEffort=True)\n\n# Display the dictionary of band means and SDs.\ndisplay(stats)\n```\n\n\nIn the output, note that the names of the reducers have been appended to the names of the\ninputs to distinguish the reducer outputs. This behavior also applies to image outputs, which\nwill have the name of the reducer appended to output band names.\n\n\nIf you are combining reducers using unweighted inputs and reducers using weighted inputs, all\nweighted inputs must be before all unweighted inputs."]]