When using SubsetOp.getTargetProduct() to clip S3 SLSTR LST data an “RuntimeError: org.esa.snap.core.gpf.OperatorException”
Here is a code:
import snappy
from snappy import ProductIOsen3_in_filename = “H:/sentinel-3/kotelny_island/S3A_SL_2_LST____20180829T031813_20180829T045912_20180830T094318_6059_035_118______LN2_O_NT_003.SEN3”
sen3_out_filename = “H:/sentinel-3/kotelny_island/test.tif”
product = ProductIO.readProduct(sen3_in_filename)
SubsetOp = snappy.jpy.get_type(‘org.esa.snap.core.gpf.common.SubsetOp’)
WKTReader = snappy.jpy.get_type(‘com.vividsolutions.jts.io.WKTReader’)lat_min = 73
lat_max = 77
lon_min = 133
lon_max = 152geom = WKTReader().read(“POLYGON(({} {}, {} {}, {} {}, {} {}, {} {}))”.format(lon_min, lat_min, lon_min, lat_max, lon_max, lat_max, lon_max, lat_min, lon_min, lat_min))
op = SubsetOp()
op.setSourceProduct(product)
op.setGeoRegion(geom)sub_product = op.getTargetProduct()
ProductIO.writeProduct(sub_product, sen3_out_filename, ‘GeoTIFF’)
then error appears:
sub_product = op.getTargetProduct()
RuntimeError: org.esa.snap.core.gpf.OperatorException
When I use similar code for SMOS L1/L2 data (for example SM_REPB_MIR_SCLF1C_20110801T151944_20110801T161257_620_183_1.DBL). Everything works fine. New raster is created, clipped and saved.
I have read, that maybe it is because of an old version of snappy where was a problem with S3 data when data were close to poles. I have updated SNAP Desktop application. Then create new snappy package using this command:
“C:\Program Files\snap\bin\snappy-conf.bat” “D:\OSGeo4W64\bin\python.exe” “D:\OSGeo4W64\apps\Python27\lib\site-packages”
Just in case I deleted .snap in user directory and snappy folder in python lib directory (in my case “D:\OSGeo4W64\apps\Python27\lib\site-packages”).
When I use SubsetOp without op.setGeoRegion(geom), new raster is created.
Maybe I have still some old version of snappy? When I type ‘pip list’ there is a ‘snappy (2.6.1)’. But I did not use pip to install snappy.
Is there some idea where could be a problem? Or what is the proper way of update snappy?
Zdenek