Google Earth Engine – Difference Between reduce(ee.Reducer.mean()) and mean() for ImageCollection

google-earth-enginegoogle-earth-engine-javascript-apireducers

I am working with S5P data for NO2. I have an image collection and want to obtain the mean NO2 for specified filters. The following code is from the documentation.

var collection = ee.ImageCollection('COPERNICUS/S5P/NRTI/L3_NO2')


.select('NO2_column_number_density')
  .filterDate('2019-06-01', '2019-06-06');

var band_viz = {
  min: 0,
  max: 0.0002,
  palette: ['black', 'blue', 'purple', 'cyan', 'green', 'yellow', 'red']
};

Map.addLayer(collection.mean(), band_viz, 'S5P N02');
Map.addLayer(meanImage,band_viz, 'another method');

I was wondering what is the use of reduce method on ImageCollection when there is a mean method already available.

var meanImage = collection.reduce(ee.Reducer.mean());

What is the difference between applying mean directly versus using reduce method

Best Answer

Did you look at the Earth Engine documentation for ImageCollection reductions?

For basic statistics like min, max, mean, etc., ImageCollection has shortcut methods like min(), max(), mean(), etc. They function in exactly the same way as calling reduce(), except the resultant band names will not have the name of the reducer appended.

In other words, the result is the same if you use .mean() or .reduce(ee.Reducer.mean()) but the latter method will append _mean to the band names.

Related Question