Undersample error using snappy

Hello everyone,

I’ve trying to undersample my Sentinel-1 IW imagery to 40 meters pixel spacing using snappy.

def do_undersample(source):
parameters = HashMap()
parameters.put(‘outputImageBy’, ‘Pixel Spacing’)
parameters.put(‘rangeSpacing’, 40.0)
parameters.put(‘azimuthSpacing’, 40.0)
output = GPF.createProduct(‘Undersample’, parameters, source)
return output

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?

Thanks.

Please have a look at this post. It explains the reason and how to deal with it.

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.