Per ridurre un Image
, utilizza image.reduce()
. La riduzione di un'immagine
funziona in modo analogo a imageCollection.reduce()
, tranne per il fatto che
le bande dell'immagine vengono inserite nel riduttore anziché nelle immagini della raccolta. L'output è anche un'immagine con un numero di bande uguale al numero di output del riduttore. Ad esempio:
Editor di codice (JavaScript)
// Load an image and select some bands of interest. var image = ee.Image('LANDSAT/LC08/C02/T1/LC08_044034_20140318') .select(['B4', 'B3', 'B2']); // Reduce the image to get a one-band maximum value image. var maxValue = image.reduce(ee.Reducer.max()); // Display the result. Map.centerObject(image, 10); Map.addLayer(maxValue, {max: 13000}, 'Maximum value image');
import ee import geemap.core as geemap
Colab (Python)
# Load an image and select some bands of interest. image = ee.Image('LANDSAT/LC08/C02/T1/LC08_044034_20140318').select( ['B4', 'B3', 'B2'] ) # Reduce the image to get a one-band maximum value image. max_value = image.reduce(ee.Reducer.max()) # Display the result. m = geemap.Map() m.center_object(image, 10) m.add_layer(max_value, {'max': 13000}, 'Maximum value image') m