Extract_information

Oh, yes. My mistake. The getPixelDouble method expects that the data is already loaded.

Either do

band.loadRasterData() 

before calling getPixelDouble (once per band is sufficient) or

data = array.array('d', [0]) 
# or with numpy
# import numpy as np
# data =np.zeros(1)
readPixels(int(pixelPos.x), int(pixelPos.y), 1, 1, data)

Is there any possibility to use the float and not convert the coordinates to integers?

no, and it makes no difference.
You will get the same pixel value either if you use

x = 34.567
y = 123.456

or
x = 34
y = 123

Did what you said but i get the following error

Traceback (most recent call last):
File “<pyshell#3>”, line 1, in
value = band.getPixelDouble(int(pixelPos.x), int(pixelPos.y))
RuntimeError: java.lang.ArrayIndexOutOfBoundsException: 6027866

Any ideas?

Is the pixel not anymore in the bounds of the image?

catch the exception and check at which x,y coordinate this happens. Check also the image bounds. Similar to this.

try:
    value = band.getPixelDouble(int(pixelPos.x), int(pixelPos.y))
except RuntimeError:
    print "x-coord:", int(pixelPos.x)
    print "y-coord:", int(pixelPos.y)
    print "band width:", band.getRasterWidth()
    print "band height:", band.getRasterHeight()

Dear Marco,
There is an error from:

pixelPos = gc.getPixelPos(GeoPos(30.7633,90.7628), None)
RuntimeError: no matching Java method overloads found

These are whole code:

from snappy import ProductIO
product=ProductIO.readProduct(‘I:/Sentinel3/PixEx-input/gaican-0726.nc’)
gc = product.getSceneGeoCoding()
pixelPos = gc.getPixelPos(GeoPos(30.7633,90.7628), None)
band = product.getBand(‘rhwon_3’)
value = band.readPixels(pixelPos.x, pixelPos.y, 1, 1).getFloat(0)
print(value)

Thanks so much.

Can you split the line into two.
Then it will be clear if getPixelPos is the problem or the GeoPos creation.
Instead of None you can try an empty PixelPos().

For others this type of call seems to work:

Dear Marco,
Thanks so much for your help.
Those codes can output data that I wanted (rhown_3).

from snappy import ProductIO
from snappy import PixelPos, GeoPos
import array
product=ProductIO.readProduct(‘I:/Sentinel3/PixEx-input/gaican-0726.nc’)
gc = product.getSceneGeoCoding()
pixelPos = gc.getPixelPos(GeoPos(30.7633,90.7628), None)
geo_pos = GeoPos(30.7633, 90.7628)
pixel_pos = gc.getPixelPos(geo_pos, PixelPos(0,0))
band = product.getBand(‘rhown_3’)
band.loadRasterData()
data = array.array(‘d’, [0])
value = band.readPixels(int(pixelPos.x), int(pixelPos.y), 1, 1, data)
print(data[0])

Then I want to batch them and obtain rhown1-21.

1 Like

Dear Marco,
I want to know if I should modify the parameters?
My target is the lake of the Tibet Plateau, they are very clean. TSM and Chla concentrations are very low. There are high altitude and low atmospheric pressure. I have just tried to modify only Salinity is 1.1, Temperature is 10.1, rhown_3 was 0.02956 (before) and 0.02926 (after). They are not very different, so if not necessary to modify the parameters?

Dear Marco,
In addition to C2RCC, what preprocessing is needed for OLCI L1 like radiative calibration? C2RCC seems to include all operations like radiation correction?
And Rrs=rhown/π right?How about rrs?Rrs=rrs?

Thanks a lot.

In some cases, it helps to apply vicarious calibration. This is explained an FAQ entry.
S3TBX FAQs - SNAP - Confluence (atlassian.net)
Otherwise, no pre-processing is required.

The π is considered by SNAP.

Dear Marco,
Thanks for your reply.
But my rhown and rrs were not from SNAP, they were processed by C2RCC in python. So I should used rrs rather rhown right?

And what is your idea about this question?

Dear Marco,
I want to know if I should modify the parameters?
My target is the lake of the Tibet Plateau, they are very clean. TSM and Chla concentrations are very low. There are high altitude and low atmospheric pressure. I have just tried to modify only Salinity is 1.1, Temperature is 10.1, rhown_3 was 0.02956 (before) and 0.02926 (after). They are not very different, so if not necessary to modify the parameters?

Thanks a lot.

I’m not a remote sensing scientist. Just a software developer. So, I fear this is not my domain and I shouldn’t reply.

Maybe @abruescas can provide more information.

I think you can use the Rrs (sr-1), but we aware of the units you use before comparing with in situ data.
In any case, if your lake is very clear, you can also check the ESA L2 standard product directly. C2RCC is designed for complex waters, and maybe you will not obtain good results.

Dear Ana,
Thanks for your reply.
Actually, there are some articles that shows that C2RCC can be used in clean water. And maybe L2 is unsuitable for clean too.

Dear Ana,
What is the Rrs? Is that in the image after C2RCC? Maybe there is no Rrs?

I want to look at the level 2 products of the standard processor and see how they compare to C2RCC products.

To obtain Rrs you have to specify it in the C2RCC output options., but yes, it is calculated within C2RCC.

1 Like

Dear Ana,
Thanks.
But which one is the level2 data? Maybe both are not? L2 couldn’t obtained from EAS?

The two are L2 data, one in Full Resolution (300 m pixel) and the other in Reduced Resolution (1200 m pixel). From the Open Access Hub ESA only land products can be dowloaded. If you want ocean products you need to access EUMETSAT Data Store: