Do you have to use topsar split/subswaths when looking at coherence?

I am trying to write a python code that will create coherence rasters but I am trying to keep it very general so it doesn’t matter what area I am looking at as long as I feed it a directory of images.

So I won’t know what subswaths to pick in the TOPSAR split step. Is it bad practice to use all the subswaths (or skip this step completely)?

Or is there a way to select the subswaths depending on an AOI you give it?

and if it is okay to process the entire image can you use a subset before starting the coherence processing steps or is that also bad practice?

From tutorials I see it seems like the common order of operations is:
TOPSAR split > Apply Orbit File > Back-Geocoding > Enhanced Spectral Diversity > Interferogram > TOPS Deburst > Topographic Phase Removal > Goldstein Phase Filtering > Subset > ( Phase Unwrapping > Phase to Displacement - not sure if these two are always needed?) > Terrain Correction

if you only want coherence rasters, you are good with

  1. TOPS Split
  2. Apply Orbit File
  3. BackGeocoding
  4. Enhanced Spectral Diversity (only if you select multiple bursts in step 1)
  5. Coherence estimation
  6. Deburst
  7. Terrain Correction

There is currently no automated way to select bursts based on an AOI in SNAP, but one has been implemented in the Snap2stamps package: a free tool to automate the SNAP-StaMPS Workflow which takes corner coordinates of an AOI to select bursts (you can check the GitHub code to see how it is done in Python). It is generally advisable to put TOPS Split at the beginning, because you can reduce the amount of data by selecting VV polarization only (VH coherence is mostly lower) and also remove areas which are of no interest.

A different approach to find the correct bursts is presented here: Python S1-TOPS-SPLIT Analyzer It’s also based on python so you might take some parts of the code which are helpful in your case.

1 Like

you are such a beauty. I will look into all of this THANK YOU

I actually managed to get the subswaths selected based on an AOI that intersects them BUT after checking the snap command line

gpt TOPSAR-Split -h

I noticed this:

PwktAoi sounds like it selects the bursts based on a polygon already? Is there actually a builtin method?

I was not aware of this parameter, it is not shown in the GUI - but I’m interested if you test it.

1 Like

It is the one I use on the master splitting script of the snap2stamps (but not integrated in the workflow).

It does intersect, but not on all IWs (or at least not last time I have checked it). So you need to do that operation for each of the IWs separately, as you cannot split several IWs at a time.

interesting maybe I’ll stick to my method of getting all the subswath geometry from the metadata and doing an intersect with my AOI, will test to see what happens with the built-in option

When trying to use the wktaoi parameter I get the error:

RuntimeError: org.esa.snap.core.gpf.OperatorException: java.util.NoSuchElementException

As soon as I remove it I loose the error, so I’m not sure if I’m doing something wrong or if it just doesn’t work but I guess I will continue with the “Read the XML, parse the geometry out, find intersects” method

Here’s what I tried to get that error:

def polygon_to_wkt(shp):
    df = gpd.read_file(shp)
    if != "EPSG: 4326":
        df = df.to_crs(4326)
    wkt = df.to_wkt()
    wkt1 = wkt.iloc[0].geometry
    return wkt1
def topsar_split(raster, aoi_shp):
    parameters = snappy.HashMap()
    parameters.put('selectedPolarisations', 'VV,VH')
    aoi_wkt = polygon_to_wkt(aoi_shp)
    parameters.put('wktAoi', aoi_wkt)
    topssplit = snappy.GPF.createProduct('TOPSAR-Split', parameters, raster)

Just a little question on the steps you listed. When I get to Terrain Correction it says “Source Product should first be deburst”. Would that be done right after TOPS split?

(thanks for all your help again)

I would calculate coherence first and then apply Debusting. I have adjusted the list in my first post.

thanks! You have helped me out SO MUCH this past week, I really appreciate it!