(Python)Question about LST calculation through snappy

Hello, I am trying to calculate the average land surface temperature for a given Sentinel-3 image using snappy. This is the code that I am using right now :

LST = product.getBand(‘LST’)
width = LST.getRasterWidth()
height = LST.getRasterHeight()
list = []

for y in range(height):
array = numpy.zeros(width, dtype = numpy.float32)
list.append(LST.readPixels(0, y, width, 1, array))

The problem is that when I compare the results with those reported by the SNAP desktop application I notice that they are different for the same set of coordinates. Am I missing something ?

Thanks in advance.

Just speculating, but might depend on how you derive the average from the numpy array, specifically how you handle NO_DATA pixels (which likely has a valid numeric value, the NO_DATA_VALUE, in the numpy array).

@jmendrok Only now I’ve realized that I did not describe my problem very well. Sorry for that. What I meant was that the numpy array itself contains different values for a given position as compared to what I can see in the LST Pixel info in SNAP. It’s been one week and I still cannot find a solution to this dilemma.

Do you open the LST_in.nc file or the xfdumanifest.xml?
If you use the nc file directly you will get different data.

You can try it in SNAP. On the left side is the full product using xfdumanifest.xml and on the right side the NetCDF file. The NetCDF has also no geo-information. This is corrected when using the full product.

Hello @marpet, initially I opened the xfdumanifest.xml and not the LST_in.nc file. As I understand, it was the correct way ?

Yes, that’s correct.
How different are the values? Are they totally off?

Not totally off. Usually the error is less than 10 degrees(K). Sometimes the values are exact though. I have a guess that the value is modified according to the flags but I am not sure.