SNAP API from Python: save a RGB image from Sentinel-2 product with resized dimension


There is a very useful script:

I’m trying to change this script to resize the RGB image, because for Sentinel-2 is created an image with 10980x10980 pixels.

How it can be resized to 1000x1000 pixels, using SNAP API?

Thanks in advance

I’ve updated the script to show how resizing can be done.

In general, it is this method:

def resize(product, targetWidth, targetHeight):
    from snappy import GPF
    from snappy import HashMap

    parameters = HashMap()
    parameters.put('targetWidth', targetWidth)
    parameters.put('targetHeight', targetHeight)
    return GPF.createProduct('Resample', parameters, product)

Thank you!

Congratulations for this great tool: the SNAP.

1 Like