Snaphu Unwrapping Core Equations

Can anyone provide any documentation about the theory of snaphu unwrapping? I want to build it using python. The c programming language is now old if we can move snaphu from c to python, I think we can take advantage of use GPU for faster computation. Please help to build snaphu in python.

these are the underlying publications by Chen & Zebker:

When you download the distribution, the source files contain the acutal code in C - including all equations, assumptions, functions…
grafik

And they are well documented actually

Yes, I already read those. But I don’t have knowledge of the C programming language. So, I want to know about the core equations.

If any of the SNAP developers reading this. Please integrate snaphu unwrapping with ESA SNAP 9.0. It is difficult to config snappu then run snaphu externally.

snaphu is already implemented as a plugin to run it from within SNAP.

What is the problem with running it in the command line? It is just the execution of a one-line command from the export.

Snaphu is not showing as plugin in SNAP 8.0 environment.

Why snaphu developers rewrite the equations in java or python. Then we can run snaphu from low-end pc. snaphu unwrapping is not working in my pc with 8 GB of RAM and ~5GB of GPU.

as stated here, it takes some days to update all plugins - they will be available soon

have you tried to increase the number of tiles?
Can you please specify the problem?

Wait I am running snaphu unwrapping using 2 bursts of S1_IW_SLC and here is the result.

F:\Sentinel1\SLC\20172019\S1A_IW_SLC__2017_2019_Orb_Stack_esd_ifg_deb_dinsar_ML_flt>snaphu -f snaphu.conf Phase_ifg_VH_24Mar2017_26Mar2019.snaphu.img 6447

snaphu v1.4.2
26 parameters input from file snaphu.conf (84 lines total)
Creating temporary directory snaphu_tiles_2568
Unwrapping tile at row 0, column 0 (pid 2024)
Unwrapping tile at row 0, column 1 (pid 8876)
Unwrapping tile at row 0, column 2 (pid 8260)
Unwrapping tile at row 0, column 3 (pid 13900)
Unwrapping tile at row 0, column 4 (pid 11632)
Unwrapping tile at row 0, column 5 (pid 5584)
Unwrapping tile at row 0, column 6 (pid 11752)
Unwrapping tile at row 0, column 7 (pid 12268)
Unwrapping tile at row 0, column 8 (pid 12036)
Unwrapping tile at row 0, column 9 (pid 11512)
Unwrapping tile at row 1, column 0 (pid 12120)
Unwrapping tile at row 1, column 1 (pid 13192)
Unwrapping tile at row 1, column 2 (pid 2052)
Unwrapping tile at row 1, column 3 (pid 2688)
Unwrapping tile at row 1, column 4 (pid 1940)
Unwrapping tile at row 1, column 5 (pid 12400)
Unwrapping tile at row 1, column 6 (pid 5692)
Unwrapping tile at row 1, column 7 (pid 5488)
Unwrapping tile at row 1, column 8 (pid 11064)
Unwrapping tile at row 1, column 9 (pid 11740)
Unwrapping tile at row 2, column 0 (pid 9232)
Unwrapping tile at row 2, column 1 (pid 7864)
Unwrapping tile at row 2, column 2 (pid 2852)
Unexpected or abnormal exit of child process 11064
Abort

Why?

We are unable to run snaphu with 8 GB of RAM. Why you are not shifting snaphu from C to python or java? Then I think computer can use cache memory to finish the process.

I’m not the developer of snaphu, so I can’t answer the question on the selection of the programming language. But as they are providing it for free, you can take it or leave it.

Have you tried to increase the number of tiles as I suggested? I see you are using 10x10. Please try 20x20 and also increase the overlap as suggested here SNAPHU parameters

Also selecting another solver (MCF or MST) can make a difference. Please do not blame the programming language for your unsuccessful attempts.

1 Like

Can you please explain what you want to say @ABraun?

the reason why your unwrapping crashes is not related to the programming languate but probably to the settings you chose.

Inside the snaphu.conf file which is exported by SNAP, you find many parameters to edit which have an impact on the processing and the results - among others:

  • INITMETHOD (test MST and MCF)
  • NTILEROW and NTILECOL (test 20 instead of 10)
  • ROWOVRLP and COLOVRLP (increase to 100)
  • NPROC (increase if your computer has more cores)

Delete temporary files, test different configurations and run snaphu again.
All these parameters are documented here: https://web.stanford.edu/group/radar/softwareandlinks/sw/snaphu/snaphu.conf.full

what is the role of those parameter tile row and column? How can I change it without knowing exactly what it is doing? Then why it is default to 10?

please read the documentation to understand the role of the parameters: https://web.stanford.edu/group/radar/softwareandlinks/sw/snaphu/snaphu_man1.html and here https://web.stanford.edu/group/radar/softwareandlinks/sw/snaphu/snaphu.conf.full

Just because the default is 10 does not mean that this is always the best setting. Especially, if the process crashes, it can be worth a try to change one parameter and compare the outcome.

If you have questions on specific points, feel free to ask.

Thank you for your help @ABraun

please don’t get me wrong. We highly encourage users to build and share their own processing chains, and I am sure that many people would be interested in a python-based unwrapping tool.
But before you implement snaphu in another programming language, you have to be clear about how it works in general.

@ABraun Can you please provide me any documentation about phase unwrapping? I really wants to know but I don’t have in-depth knowledge about those.

what about the original articles? No one can explain the concept better than the ones who delveloped it.

There are also good materials around:

I am joining this conversation late, but Python and Java programs generally use much more memory and CPU time to do the same task as a well-written C program. I don’t know of any version of SNAPHU that can use GPU computations. The type of optimization that SNAPHU is doing is not likely to run efficiently on a GPU. If you want to use a GPU, then you would need to rewrite the code with the CUDA language.

2 Likes