Hi there,
I have been processing data in python with snappy since January 2017 (as part of the S3VT we
receive data for our region from the ftp rolling archive.) However, I have been getting an error for files
downloaded after about 5 April 2017. The last file that I am able to subset successfully within
python is:
S3A_OL_2_WRR____20170405T072830_20170405T081238_20170405T100300_2648_016_149______MAR_O_NR_002.SEN3
However, for files after that date, like this one from the 8th of April:
S3A_OL_2_WRR____20170408T075036_20170408T083446_20170408T102644_2650_016_192______MAR_O_NR_002.SEN3
I have been receiving the following error:
Traceback (most recent call last):
File “”, line 11, in
File “E:\S3A\code\subset_data_test.py”, line 24, in subset_beng
sp = op.getTargetProduct()
RuntimeError: java.lang.IllegalArgumentException: Points of LinearRing do not form a closed linestring
I have a similar error when I try to use Graph Builder for the 8th (Error: Points of LinearRing do not form a closed
linestring), while it still works for dates before that. I include my python snappy subsetting code, which I have
previously applied successfully in python, below. As far as I can see my polygon should be fine?
import snappy
from snappy import ProductIO
import numpy as np
import sys
def subset_beng(fname,filename,options):
SubsetOp = snappy.jpy.get_type(‘org.esa.snap.core.gpf.common.SubsetOp’)
WKTReader = snappy.jpy.get_type(‘com.vividsolutions.jts.io.WKTReader’)
wkt ='POLYGON ((16 -30, 20 -30, 20 -35, 16 -35, 16 -30))'
geom = WKTReader().read(wkt)
p = ProductIO.readProduct(fname+'/xfdumanifest.xml')
op = SubsetOp()
op.setSourceProduct(p)
print("Getting subset of "+filename[0:24])
op.setGeoRegion(geom)
sp = op.getTargetProduct()
if sp.getSceneRasterWidth()>0:
print("Writing subset of "+filename[0:24])
ProductIO.writeProduct(sp, options.subdir+filename+"_beng_subset.nc", "NETCDF4-BEAM")
print("Done with subsetting")
else:
print("Area not in orbit. Carry on to next file")
I am still able to subset my region of interest in SNAP manually when exporting to NetCDF4-BEAM
format, and then continue processing in python. However, I need to automate this step for future operational
processing chains.
Has something changed in the file structures? Please help
Kind regards,
Marie