Why calculated NDVI is different from the one downloaded from EOBrowser?

Hi,

I have downloaded Sentinel 2 raw data through the sentinelhub Python library*. Then, I read the .TIFF files with GDAL library and stored the data in a pandas.DataFrame.

* using Python library I can only download S2 raw data in their original format (UINT16), while when downloading through EO Browser I can get it also in FLOAT32.

I tried to calculate NDVI as (B8-B4)/(B8+B4) and I got Python float64 values. Unfortunately, these values are different from the ones I get when donwloading NDVI raw data in EO Browser.

Is this difference caused by the different format of input values (UINT16 vs FLOAT32)?

If so, is there a way to get FLOAT32 values for S2 raw data? (SampleType.FLOAT32 doesn’t work).

Thanks for your help.

Hello Cesare,

Were you downloading the default NDVI layer available in the analytical download in EO browser? If so, that is a so-called “visualized” layer, which maps specific colours to NDVI values for nicer visualisation.

If so, to get the actual NDVI value, you can use a custom script:

An option for “custom” should be preselected when you open the analytical download. Hopefully the values match this time.

Best regards,

Jan

Hi @jan.jezersek,

actually I notice this difference and recreated a custom NDVI using the “Index” panel and combining the needed bands. In fact, I got the same results I get using the script I found at the link you provided me.

Anyway, I still got difference between calculated and downloaded values. :frowning_face:

Thanks a lot for your advice.

The values produced by the the “Index” panel shouldn’t be the same as the one I provided. The evalscript produced by the “Index” panel also does some processing for improved visualisation.

What kind of differences do you get, could you show an example?

The following image is what I see when open in QGIS the raw data I get using your link.
clean_ndvi_script

The following image is what I see when open in QGIS the raw data I get using “Index” panel.
index_panel

As you can see, the only difference is that values are repeated (because of the different evalscript); in fact, it returns values for RGB bands and one more “data mask” band. Anyway, values of interest are actually the same.

Thanks for your suggestion :wink:

I see, I was interested in the example of the difference between the data downloaded from EO browser versus using the python client, though.

Are you using the same collection in both cases (either L1C or L2A)? EO browser has atmospherically corrected Sentinel-2 L2A selected by default.

Yes! Same collection, S2-L2A.

While looking for the reason behind the difference, I observed that the images downloaded via API and those downloaded via EO Browser have different pixel size. I don’t know if these could interfere, so before contuining answering on this topic I’ve created a new one (API vs. EO Browser: images have different pixel size) to understand the other problen, while keeping this conversation clean. Feel free to reply, if you want :slight_smile:

Hi, i have a similar problem.I download the NDVI result from the python api but the scale is not (-1.1) but it is (0.255).
What would be the conversion table between the different scales?

You need to configure Evalscript appropriately, see: