TOPSAR-Split error OperatorException: -1 with multiple swaths

I am once again asking for help from this great community.

I am trying to run some code in snappy and the TOPSAR-Split gives me the following error:

topssplit = snappy.GPF.createProduct(‘TOPSAR-Split’, parameters, raster)
RuntimeError: org.esa.snap.core.gpf.OperatorException: -1

My input is the following:

import snappy 
import jpy
HashMap = jpy.get_type('java.util.HashMap')

def topsar_split(raster):

    parameters = snappy.HashMap()
    parameters.put('subswath', 'IW2,IW3')
    parameters.put('selectedPolarisations', 'VV,VH')
    topssplit = snappy.GPF.createProduct('TOPSAR-Split', parameters, raster)

    print("[INFO] TOPS-Split done")
    return topssplit

image1 = snappy.ProductIO.readProduct(
topsar_1 = topsar_split(image1)

Did I input the parameters wrong? Here’s the full error I get:

Traceback (most recent call last):
  File "C:\Users\ET\.conda\envs\sar\lib\site-packages\IPython\core\", line 3343, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-11-dbccef726ac3>", line 1, in <module>
    topssplit = snappy.GPF.createProduct('TOPSAR-Split', parameters, raster)
RuntimeError: org.esa.snap.core.gpf.OperatorException: -1

edit: this error only seems to happen when I select more than one swath, what’s the proper way to specify more than one?

I think you cannot specify more than one subswath. If you check in the SNAP GUI, TOPSAR-Split only lets you choose one subswath at a time too.

Maybe you would be interested in the TOPS-Merge tool. You process the subswaths separately then merge them together.

See thread:

1 Like

ah yes that makes sense, thanks!

I stumbled over the same issue.
If only one subswath is allowed it would probably good to change the description in the help of the TOPSAR-SPLIT operator? It says:

Psubswath=<string> The list of source bands.

At least for me, a list sounds as I can define multiple subswaths, and thus I tried to find out how to specify multiple ones.

What is the reaon not to allow multiple subswaths? If I use the whole scene I also process mutliple subswaths and it runs.