What are the NDVI Flags (how to get them)?

Hello all,

I hope you can forgive my ignorance. I am calculating NDVIs with snappy basically with Sentinel 2 L1C image. I can calculate the proper NDVI and also the NDVI flags (from the example in this link) but I was wondering. What are the NDVI flags and how to define the thresholds (NDVI low & NDVI high). So far I have been testing with some random values and when I plot them I just see a dark image.


Image: NDVI and NDVI flags (0 - 1 respectively) where you can see the black outcome

Any info is more than welcome.

Thanks a lot!!

The flags generated in the python example are just showing the concept of creating flags.
image
The two threshold values (0.0 and 1.0) might never occur in your data (both exceptional cases). Then no flag is raised. Check the histogram of your ndvi data for the value range.
However, you can also change these thresholds. For example to 0.2 and 0.8.

1 Like

Thanks a lot for your answer, I guess I will have to calculate the mean and standard deviation for each ndvi frame though.
Is there a snappy operator that allow us to extract the “stdd” and “mean” from a “.dim” file? (similar to gdal.stats)

Not an operator but there is a class you can load in python:

org.esa.snap.core.datamodel.StxFactory

then you can use it like:

Stx stx = new StxFactory().withRoiMask(mask).create(raster, pm)

or simply

Stx stx = new StxFactory().create(raster, pm)

Then you can call

stx.getMean()
stc.getStandardDeviation()

And other information. See API-Doc:
StxFactory and Stx

This is still java syntax and needs to be converted to python.