medoid#
- geetools.ee_image_collection.ImageCollectionAccessor.medoid(bands=None, metric='sam')#
Compute the medoid of the
ee.ImageCollection.The medoid is the image that has the smallest sum of distances to all other images in the collection. The distance is computed pixelwise using the selected spectral distance metric. No band normalization is applied internally, so the result depends on the scale of the selected bands. In practice, this means inputs should already be on a meaningful and comparable scale, for example reflectance bands after applying scale and offset factors.
- Parameters:
bands (list | None) – The list of bands to consider when computing the medoid. Defaults to None, which uses all bands.
metric (str) – The spectral distance metric to use. One of
"sam"(spectral angle mapper),"sid"(spectral information divergence),"sed"(squared Euclidean distance), or"emd"(earth movers distance). Defaults to"sam"."sam"is often a good default for spectral composites because it emphasizes spectral shape over magnitude, while magnitude-based metrics such as"sed"are more sensitive to band scaling.
- Returns:
An Image that is the medoid of the
ee.ImageCollection.- Return type:
Examples
import ee, geetools ee.Initialize() collection = ( ee.ImageCollection("LANDSAT/LC08/C01/T1_TOA") .filterBounds(ee.Geometry.Point(-122.262, 37.8719)) .filterDate("2014-01-01", "2014-12-31") ) medoid = collection.geetools.medoid() print(medoid.getInfo())