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?
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.