I’ve trying to undersample my Sentinel-1 IW imagery to 40 meters pixel spacing using snappy.
parameters = HashMap()
parameters.put(‘outputImageBy’, ‘Pixel Spacing’)
output = GPF.createProduct(‘Undersample’, parameters, source)
When I run this function I wrote above, I always get the error:
RuntimeError: org.esa.snap.core.gpf.OperatorException: Operator ‘UndersamplingOp’: Value for ‘Azimuth Spacing’ must be of type ‘float’
However, I did put ‘40.0’ which is a float type number in the ‘azimuthSpacing’ parameter. This error does not appear when I manually run Undersample in the SNAP software. Can anyone tell me why?
Please have a look at this post. It explains the reason and how to deal with it.
The problem is that the python value ‘0.05’ is a double-precision data type.
The Warp expects a single precision float value.
You can either remove the parameter rmsThreshold, because ‘0.05’ is the default, or you do the following:
Float = jpy.get_type('java.lang.Float')
I haven’t tried it, but I think this will work.
Thanks! That was very helpful.
Just a comment. I found that specifying 40 meter pixel spacing in the undersample tool can lead to the image to be shifted after terrain correction. However, specifying the ratio rather than pixel spacing won’t have this problem. Although it seems that using terrain correction alone (specifying pixel spacing there) can be a better option if terrian correction is needed.