What is the FASTEST way to calculate the min and max of one band of an ee.Image?
I have tried using ee.reduceRegions in the following code, but it adds seconds to my processes. I am using this in a custom Angular application and need to make frequent calls to this method - speed is critical!
Is it possible to just use ee.reduce()? This seems to return an image not a number...
// Private method to add min, max, and mean stats to the properties of any image
exports._add_stats_to_image = function(projectionResult) {
// try adding the image stats as metadata before returning the image
var reducers = ee.Reducer.mean().combine({
reducer2: ee.Reducer.minMax(),
sharedInputs: true
});
var stats = projectionResult
.select("b1") // band is now labelled "b1" for all single band image results
.reduceRegion({
reducer : reducers,
// geometry: geom,
bestEffort: true,
crs: "EPSG:4326",
scale: ee.Number(100),
maxPixels: ee.Number(1e9),
});
return projectionResult
// .clip(geom)
.set("mean", stats.get("b1_mean"))
.set("min", stats.get("b1_min"))
.set("max", stats.get("b1_max"));
}