geetools.ImageAccessor.reduceBands#

geetools.ImageAccessor.reduceBands(reducer, bands=[], name='')#

Reduce the image using the selected reducer and adding the result as a band using the selected name.

Parameters:
  • bands (geetools.types.ee_list) – The bands to reduce

  • reducer (str) – The reducer to use

  • name (geetools.types.ee_str) – The name of the new band

Returns:

The image with the new reduced band added

Return type:

ee.Image

Examples

import ee, geetools

ee.Initialize()

image = ee.Image('COPERNICUS/S2_SR_HARMONIZED/20200101T100319_20200101T100321_T32TQM')
image = image.geetools.reduceBands("mean", ['B1', 'B2'])
print(image.bandNames().getInfo())