Is preprocessing S1 SLC data with snappy realistic?

I am trying to use snappy to preprocess S1 SLC data. I have many files to process and don’t want to sit there running multiple graphs, even in batch processes. Is this idea realistic?

Currently I am trying to implement the TOPSAR-Split operator with

def module1_swath_n(product, swath_number):

    band_names = product.getBandNames()
    swath_bands = [band for band in band_names if f"IW{swath_number}" in band]

    parameters = snappy.HashMap()
    parameters.put('selectedPolarisations', swath_bands)
    split_swath = snappy.GPF.createProduct('TOPSAR-Split', parameters, product)

and am running into the

ValueError                                Traceback (most recent call last)
Cell In[56], line 1
----> 1 module1_swath_n(product, 1)

Cell In[55], line 11, in module1_swath_n(product, swath_number)
      6 #TOPSARSplitOp = snappy.jpy.get_type('org.esa.s1tbx.sentinel1.gpf.TOPSAR-Split')
      7 #split_product = snappy.TopSARSplitOp(product, subswath=f"IW{swath_number}", selectedPolarisations=swath_pol_bands)
      9 # TOPSAR Split
     10 parameters = snappy.HashMap()
---> 11 parameters.put('selectedPolarisations', swath_bands)
     13 split_swath = snappy.GPF.createProduct('TOPSAR-Split', parameters, product)

ValueError: cannot convert a Python 'list' to a Java 'java.lang.Object'

problem, as detailed (ultimately with no answer) in this thread.

An solution to the above problem would be great, but also an answer to the question of is it realistic for a person who has some coding experience but is definitely not a software engineer to be able to fully implement S1 SLC preprocessing, from all the way to dual-pol eigen decomposition etc.?

Edit: just to clarify, I the end of the linked thread says something like “passing lists as parameters is meant to be implemented in the future, but that hasn’t yet happened”.

1 Like

I would suggest to not use esa_snappy, but rather use GPF to do all the pre-processing.

Begin by creating the Graphs in SNAP and saving them as XMLs. I then edit the XML an put easily findable parameters that I can replace without going line by line through the file, or in some of my earlier ones I would just flip through the lines and edit specific ones. I have an example of this below. Just depends what you’re comfortable with.

Use Python to setup and create all the paths from file to file, edit the XML to point to the path Input and Output, then use subprocess to run the edited XML with GPF.

I have tried to use snappy for this but it’s complicated and not well documented. I find there are little differences in many of the tools that are difficult to sort out. If you were a Java programmer you’d have an easier time of it I think. I am not.

But once set up, the above method is fairly elegant, IMHO. Here is some code to get you started,



Amazing answer, @cndnflyr, thank you. I will give that a go. I already have all graphs set up so that will help.

Hi, how can I use the S3A_SL_1_RBT____20230101T142723_20230101T143023_20230101T153300_0179_094_025_0360_PS1_O_NR_004.SEN3 image to calculate the surface temperature after atmospheric correction?