Thanks for the details.
You export B4 and B8 to GeoTiff and then calculate NDVI in Python/Matlab.
So, the issue is with the export to GeoTiff and not the calculation of NDVI in SNAP. And this issue is more than 15 years old.
When exporting to GeoTiff only the raw values are exported.
You can see it in the screenshot. QGIS show UINT16 as data type.
This was a wrong decision event though there where good reasons to do so at this time.
You have 3 options, I think.
- Not using GeoTiff use NetCDF4-CF instead
- Apply the scaling and create new band in SNAP
Simply create a new band (not virtual) using BandMaths by using only the original band name. - Apply the scaling in Python/Matlab
The equation is:v = raw * factor + offset
factor = 0.0001
offset = -0.1