I have a long python code that was working with Sentinel-2 single tile data format with long names (single tile data before 6.12.2016). After updating a few days ago to the recent versions of snappy, sen2cor, snap, etc, it is not working anymore. For the same code for data before 6.12.2016 error is :
AttributeError: 'NoneType' object has no attribute 'getSceneRasterWidth'
and for data after 6.12.2016 error is:
File "test4_3.py", line 180, in computeSnappyMasks b4.readValidMask(0, y, width, 1, v4) RuntimeError: java.lang.IllegalArgumentException: expression: Referenced rasters must be of same size
So, in my code I am using:
product = ProductIO.readProduct(filename) print product #testing width = product.getSceneRasterWidth()
None, for short-name data I get
org.esa.snap.core.datamodel.Product[name=S2A_MSIL2A_20170207T095151_N0204_R079_T35VLH_20170207T095148] which seems OK. Why is this so? What would be a solution for long name data? I’m sure that is the reason for the later error regarding
And about the second error, relevant parts of code might be:
product = ProductIO.readProduct(filename) width = product.getSceneRasterWidth() b4 = product.getBand('B4') v4 = np.zeros(width, dtype=np.uint8) for y in range(height):
b4.readValidMask(0, y, width, 1, v4)
I am wondering about this one because it was working before. I’ve never had a similar error.
filename is an absolute path to L2A product with extension .SAFE.