Snap2stamps package: a free tool to automate the SNAP-StaMPS Workflow

Regarding the ps_load_initial_gamma I do not remember to had modified it. So it should work as it is. Let me know if this is not the case and I will share my mt_prep_gamma and ps_load scripts.

Regarding DEMs, indeed the use of a more accurate and updated DEM is better, but it becomes more important when working with higher resolution SAR (X-band stripmap for example). Indeed there are many DEMs that could be used, ie: SRTM DEM (3 or 1 arc second), ALOS DEM, TanDEM-X, etc , but always in GeoTIFF for being used using SNAP.

Can we add an aoiWKT to splitting slaves graph?
Currently the slaves are split but all the bursts are kept. Bursts are only extracted during co-regestration where only bursts overlapping with the master are kept. This creates unnecessary size and processing requirements.
The splitting slaves graph can then in fact be used to split the master too the the requirements of the project.conf file.

Yes, why not!
Had you successfully use it on any test before?
I have tried to use it just yesterday and I got an error.
So, if you provide me with a working example I will do it for next release.

One question, what happens if the AOI it between two subswaths?

2 Likes

I quickly cloned your package to https://github.com/andretheronsa/snap2stamps and made the changes I think are needed and tested it once and it seems to work! It splits MUCH quicker for small study areas since it only processes the required bursts. I havn’t done the next steps yet, so not 100% sure having less burst would break the next steps. I assume as long as you have more than one burst it will work (less then one would make ESD coreg fail right?)

TOPSAR-split only uses the AOI to select bursts, so I don’t think it matters if it is out of bounds or in another swath, it only looks for intersecting bursts in the current swath.

Summary of changes: (Only small changes needed)
splitting_slaves.py now reads the polygon data in too (from line 46) with the code from coreg_ifg_topsar.py;

  if "LONMIN" in line:
  	LONMIN = line.split('=')[1].strip()
            if "LATMIN" in line:
                    LATMIN = line.split('=')[1].strip()
            if "LONMAX" in line:
                    LONMAX = line.split('=')[1].strip()
            if "LATMAX" in line:
                    LATMAX = line.split('=')[1].strip()

polygon=‘POLYGON ((’+LONMIN+’ ‘+LATMIN+’,’+LONMAX+’ ‘+LATMIN+’,’+LONMAX+’ ‘+LATMAX+’,’+LONMIN+’ ‘+LATMAX+’,’+LONMIN+’ ‘+LATMIN+’))’

slave_assemble_split_apply_orbit.xml and slave_split_apply_orbit.xml gets polygon added to node id =TOPSAR split(1/2): (this example I had to add a space between the arrows to work on this forum)

< wktAOI > POLYGON < / wktAOI >

This way the python script reads the project.conf polygon and gives it to the graph to run extract only the relevant bursts.

I think this way the master can also be prepared with the splitting slaves scripts but not sure how you would incorporate this.

I just tested it once with an AOI that overlaps 3 bursts, no time for proper testing sorry, on my way for a holiday break. Enjoy!

1 Like

Yes, indeed this is exactly what I have done, but still I got SNAP error on the TOPSAR-Split operator. I will give a try on other machine.

Thanks

I’d like to share what I found relating to use SNAP AND StaMPS, I think those two articles are good answer for many questions, I don’t know in case of they have been posted before, but anyhow, I’d like to post them once more,

Foumelis_et_al_IGARSS2018_SNAP-StaMPS[42].pdf (591.3 KB)

Hallo @mdelgado thank for snap2stamps.
I already run splitting_slaves.py and slaves_prep.py it’s going well no have problem. But when I try coreg_ifg_topsar.py I found some problem:
Error: [NodeId: Subset(2)] Operator ‘SubsetOp’: Could not parse geometry.

can you tell me what’s wrong with my step?
I already try various name format for master.

error:

master name format:
image

Thank for everything…

It could be related to the coordinates defined in the config file. Can you please share it here as well?

1 Like

Thanks @ABraun. In fact I suspect that the error should come from there.
Let us know

Thank you @ABraun and @mdelgado for your reply.
I just fix my config file, but found another error I think it come from my memory not enough.

image

The Master image should not contain IW3…
I think this is creating the issue.
I hope this helps
Best regards

Hi,

Do you have the Docker image available somewhere on Docker Hub? @andretheronsa I am trying to achieve exactly the same.

First of all, thanks for your work on snap2stamps @mdelgado ! When I try to run the scripts with 2 sample S-1 images, the scripts run without error, but they do not produce any output. When trying coreg_if_topsar.py script, I get the following error:

 Error: [NodeId: Subset(2)] Operator 'SubsetOp': Could not parse geometry.

Here is my config file:

Could the problem originate in not specifying a BBOX? Or is it not necessary?

Thanks

Exactly. You should either defined the BBOX in the project.conf or change the graphxml template from the coreg_ifg_computation.py to use the xml without subset in the name.

Let me know

Works great! Thank you. I also used the scripts in Python 3, after some simple adjustments, which works fine.

2 Likes

Do you feel like contributing on the next package version for supporting also python 3?
Feel free to share with us your code. Now I am just developing new improvements but always only for the version 2.7.

Thanks

@mdelgado Yes I would love to! I will send you the python 3 code for the current version and would not mind contributing for the next package version. Just tell me how to get in touch.

Thanks

hello~~Thank for snap2StaMPS again.
I wanna ask a question about “SNAP2StaMPS_CONFIG.bash”
Should I add it to ~/.bashrc before the python process?

Is it not strictly necessary to use the SNAP2StaMPS_CONFIG.bash, you could directly add to the PATH variable the bin folder containing the python scripts of the package.

But once modified the SNAP2StaMPS_CONFIG.bash file (if you want to use it), yes, you can add it into the .bashrc for avoiding to load it every time.

I hope I have answered your question

1 Like

Thank a lot !!!
I just occur some error

[3] Folder: 20170421
/Users/ray303/Desktop/2017landslide/PROJECT/slaves/20170421
['/Users/ray303/Desktop/2017landslide/PROJECT/slaves/20170421/S1A_IW_SLC__1SDV_20170421T100023_20170421T100053_016241_01ADB3_11F3.zip']
FILE(s) :     /Users/ray303/Desktop/2017landslide/PROJECT/slaves/20170421/S1A_IW_SLC__1SDV_20170421T100023_20170421T100053_016241_01ADB3_11F3.zip
['/Applications/snap/bin/gpt', '/Users/ray303/Desktop/2017landslide/PROJECT/graphs/splitgraph2run.xml', '-c', '16G', '-q', '8']
SNAP STDOUT:INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters
INFO: org.esa.s2tbx.dataio.gdal.activator.GDALDistributionInstaller: No distribution folder found on Macintosh.
Executing processing graph
SEVERE: org.esa.snap.core.dataop.downloadable.XMLSupport: Path to xml is not valid: invalid LOC header (bad signature)
SEVERE: org.esa.s1tbx.commons.io.SARReader: org.esa.s1tbx.io.sentinel1.Sentinel1ProductReader
[input=/Users/ray303/Desktop/2017landslide/PROJECT/slaves/20170421/S1A_IW_SLC__1SDV_20170421T100023_20170421T100053_016241_01ADB3_11F3.zip]:
invalid LOC header (bad signature)
 done.

Error: [NodeId: Read] org.esa.s1tbx.io.sentinel1.Sentinel1ProductReader
[input=/Users/ray303/Desktop/2017landslide/PROJECT/slaves/20170421/S1A_IW_SLC__1SDV_20170421T100023_20170421T100053_016241_01ADB3_11F3.zip]:
invalid LOC header (bad signature)

[3] Finished process in 3.54374599457 seconds.

#####################################################################

[4] Folder: 20170503
/Users/ray303/Desktop/2017landslide/PROJECT/slaves/20170503
 ['/Users/ray303/Desktop/2017landslide/PROJECT/slaves/20170503/S1A_IW_SLC__1SDV_20170503T100024_20170503T100054_016416_01B302_4330.zip']
FILE(s) :      /Users/ray303/Desktop/2017landslide/PROJECT/slaves/20170503/S1A_IW_SLC__1SDV_20170503T100024_20170503T100054_016416_01B302_4330.zip
['/Applications/snap/bin/gpt', '/Users/ray303/Desktop/2017landslide/PROJECT/graphs/splitgraph2run.xml', '-c', '16G', '-q', '8']
SNAP STDOUT:INFO: org.esa.snap.core.gpf.operators.tooladapter.ToolAdapterIO: Initializing external tool adapters
INFO: org.esa.s2tbx.dataio.gdal.activator.GDALDistributionInstaller: No distribution folder found on Macintosh.
Executing processing graph
INFO: org.hsqldb.persist.Logger: dataFileCache open start
....10%....20%....30%....40%....50%....60%....70%....80%....90% done.

[4] Finished process in 21.3632209301 seconds.
Split slave    
['/Users/ray303/Desktop/2017landslide/PROJECT/slaves/20170503/S1A_IW_SLC__1SDV_20170503T100024_20170503T100054_016416_01B302_4330.zip'] successfully completed.

I run 14 images for the process of splitting_slaves.
However, some images are fine, but some images are happening ERROR: invalid LOC header (bad signature).
I don’t know how to solve the error.
All the images are splitting well when running TOPS-split method in SNAP.

could it be that image #3 from 21.07.2017 wasn’t correctly downloaded?
Check and compare the fize sizes and try to open this one in SNAP.

1 Like