reduce over bands

Reducers applied on an image reduce all bands to a single band.


An example in the code below or use this link.

// User specified parameters

// create the vizualization parameters
var vizTrue = {bands: ['B4', 'B3', 'B2'], max: 2048};
var viz = {min: 0.0, max: 5000, palette:['black', 'white']};

// Data
var image = ee.Image("COPERNICUS/S2/20161104T155522_20161104T212609_T17QQE");

// Functions
// Reduce the image to get a one-band maximum value image.
var maxValue = image.reduce(ee.Reducer.max());

// Add to map
Map.addLayer(image,vizTrue,"True color");
Map.addLayer(maxValue,viz,"Maximum value");

Sentinel 2 image of the Bay of Buena Vista, Cuba. On the left the true color image, the right image shows the reduced image with the maximum values of all bands.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s