1

One of the answers to this question (Google Earth Engine - Get Image with highest max Scene NDVI from a time period) provides code which gives a Sentinel image/date with the highest NDVI for each region (https://code.earthengine.google.com/5165eca22f5dbfc8e114919d9315ab73).

This is half of what I want, but I also want the Sentinel image/date of the lowest NDVI for a region, but am not sure how. I have tried changing

return ee.Feature(meanFeatureCollection.sort('mean').first()

to descending order, but it didn't change the console output.

EDIT: I double checked and the link code doesn't actually do as described, it only prints the NDVI and ID of first Sentinel image in the collection. So I also need the correct script to identify highest AND lowest NDVI images.

2
  • In the code provided as an answer to the question you referred to, code.earthengine.google.com/013a113d3f01c192ff7370d236197a8a For lowest value, just change to .aggregate_min('mean') in the var highestMean = mosaicsWithMean.aggregate_max('mean')
    – Es_a
    Feb 23, 2022 at 15:04
  • thank you very much. if you want to post this as answer, i'll accept it. either way thanks Feb 23, 2022 at 16:44

1 Answer 1

1

In the link here, the code provided as an answer to the question you referred to.
For getting lowest value, you can change max to min

var highestMean = mosaicsWithMean.aggregate_max('mean')

to

var lowestMean = mosaicsWithMean.aggregate_min('mean')
1
  • thanks so much. I also want to turn all negative ndvi values used in the calculations to 0, but I can't figure out what/how to alter this code Mar 1, 2022 at 15:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.