Hello,
this thread is very useful, and I am modifying the script proposed by panagiutos1 and modified by marpet to extract single pixel information from Sentinel 3 OLCI data. I have tried both using xml and netcdf files as source products. I adapted the script suggested, but at the end I get an error. No matter how I try, I canât understand the cause. Could you please help me?
Here is my script, launched as .py:
;;;;
import snappy
import jpy
import datetime
import snappy
from snappy import GPF
from snappy import File
from snappy import Product
from snappy import ProductUtils
from snappy import ProductIO
from snappy import GeoPos
from snappy import PixelPos
from snappy import HashMap
Coord = jpy.get_type(âorg.esa.snap.pixex.Coordinateâ)
HashMap = snappy.jpy.get_type(âjava.util.HashMapâ)
inf=â/OCEANASTORE/progetti/ocean_color/Copernicus/Rrs/cmems_rrs.ncâ
#product=ProductIO.readProduct(inf+âxfdumanifest.xmlâ)
product=ProductIO.readProduct(inf)
bands = list(product.getBandNames())
print (bands)
Coord = snappy.jpy.get_type(âorg.esa.snap.pixex.Coordinateâ)
Date = snappy.jpy.get_type(âjava.util.Dateâ)
my_coordinates=jpy.array(âorg.esa.snap.pixex.Coordinateâ, 5)
my_coordinates[0] = Coord(âname1â,42.60613, 11.00893, None)
parameters = HashMap()
parameters.put(âexportBandsâ, True)
parameters.put(âexportExpressionResultâ, False)
parameters.put(âexportMasksâ, False)
parameters.put(âexportTiePointsâ, False)
parameters.put(âoutputDirâ, â/home/ocean/projects/snap/examples/outputâ)
parameters.put(âcoordinatesâ, my_coordinates)
c=GPF.createProduct(âPixExâ, parameters, product)
;;;
The error I get is:
Traceback (most recent call last):
File âpixel_extraction_CL.pyâ, line 44, in
c=GPF.createProduct(âPixExâ, parameters, product)
RuntimeError: java.lang.NullPointerException
The python version I have is 3.6.15. The java version is 11.0.19. The UBUNTU version is 22.04.2.
The coordinates I give are in the area included in the .nc file.
Thank you in advance, regards
Chiara