お知らせ:
2025 年 4 月 15 日より前に Earth Engine の使用を登録したすべての非商用プロジェクトは、Earth Engine へのアクセスを維持するために
非商用目的での利用資格を確認する必要があります。
レデューサの概要
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
リジューダは、時間、空間、バンド、配列などのデータ構造にわたってデータを集計する方法です。ee.Reducer
クラスは、データの集計方法を指定します。このクラスの Reducer では、集計に使用する単純な統計情報(最小値、最大値、平均値、中央値、標準偏差など)や、入力データのより複雑なサマリー(ヒストグラム、線形回帰、リストなど)を指定できます。削減は、時間(imageCollection.reduce()
)、空間(image.reduceRegion()
、image.reduceNeighborhood()
)、バンド(image.reduce()
)、または FeatureCollection
の属性空間(featureCollection.reduceColumns()
または FeatureCollection
メソッドで、aggregate_
で始まるメソッド)で発生する可能性があります。
レジューサーは入力データセットを受け取り、単一の出力を生成します。単一の入力 Reducer がマルチバンド画像に適用されると、Earth Engine は Reducer を自動的に複製し、各バンドに個別に適用します。その結果、出力画像のバンド数は入力画像と同じになります。出力の各バンドは、入力データの対応するバンドからピクセルが削減されたものです。一部の reducer は、入力データセットの Tuple を受け取ります。これらのレジューサーは、バンドごとに自動的に複製されません。たとえば、ee.Reducer.LinearRegression()
は、特定の順序で複数の予測子データセット(回帰の独立変数を表す)を取ります(回帰リデューサーをご覧ください)。
一部の Reducer は、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 API とインタラクティブな開発で geemap
を使用する方法については、
Python 環境のページをご覧ください。
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())
これにより、入力のバンド数の 2 倍の出力が生成されます。出力のバンド名には、バンド名に「_min」または「_max」が追加されます。
出力タイプは計算と一致している必要があります。たとえば、ImageCollection
に適用されるリデューサーには Image
出力があります。出力はピクセル値として解釈されるため、ImageCollection
を減算するには、数値出力を持つリデューサを使用する必要があります(toList()
や histogram()
などのリデューサは機能しません)。
デフォルトでは、ピクセル値の減衰はマスクによって重み付けされますが、この動作は変更できます(重み付けのセクションをご覧ください)。マスクが 0 のピクセルは、圧縮に使用されません。
リデューサーの組み合わせ
複数の Reducer を同じ入力に適用する場合は、効率性を高めるために Reducer を combine()
することをおすすめします。具体的には、sharedInputs
が true
に設定されたレジューダで combine()
を呼び出すと、データに 1 回だけパスが実行されます。たとえば、画像内のピクセルの平均と標準偏差を計算するには、次のようなコードを使用します。
コードエディタ(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 API とインタラクティブな開発で geemap
を使用する方法については、
Python 環境のページをご覧ください。
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)
出力では、レジューサーの出力を区別するために、レジューサーの名前が入力の名前に追加されています。この動作はイメージ出力にも適用されます。出力バンド名には、レジューサーの名前が追加されます。
重み付けなしの入力を使用するリデューサーと重み付け付きの入力を使用するリデューサーを組み合わせる場合は、すべての重み付け付き入力がすべての重み付けなしの入力の前に配置されている必要があります。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-25 UTC。
[null,null,["最終更新日 2025-07-25 UTC。"],[[["\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."]]