SNAPHU Unwrapping


Currently there are more scenes over my study area. After averaging some resulting DEMs, I got quite good results but I’m still improving the final model. Thank you all for helping!!! I will post here the final DEM as soon as I finish it!


Please keep us updated when you will have your final results. Good to see nice products coming from the toolbox… Cheers


After averaging three DEMs obtained by interferometry of Sentinel TOPS I got the DEM showed below! I confess that I was expecting better results… In my guess it would be better use SRTM 1 arc sec products. The Sentinel 1 DEM has an absolute resolution of 15m.


Hi there

finally, some updates…

After masking out the part of scene covered by sea (using DEM as reference for mask), I have been able to unwrap S1A IW interferogram. My target was in a single frame, or tile, so i applyes SNAPHU only to it.
since i gave no limitations on minimum coherence values, it took a very long, long time, as stated in standard output messages reported below.

I think most of the time has been lost for disk I/O during swapping. The process consumed about 13Gb out of the 16Gb available ram and almost all 32Gb swap.

the output to std out has been:

me@mypc:~/Sentinel_1_Data/OUTPUT/SNAPHU/S1A_IW_SLC__1SDV_20150729T050333_20150729T050400_007021_009897_3CFC_IW1_ifg_deb_dinsar_flt_msk$ time snaphu -f snaphu.conf

snaphu v1.4.2
27 parameters input from file snaphu.conf (84 lines total)
Logging run-time parameters to file snaphu.log
Reading wrapped phase from file Phase_ifg_srd_IW3_VV_29Jul2015_15Sep2015.snaphu.img
No weight file specified. Assuming uniform weights
Reading correlation data from file coh_IW3_VV_29Jul2015_15Sep2015.snaphu.img
Calculating deformation-mode cost parameters
Building range cost arrays
Building azimuth cost arrays
Initializing flows with MST algorithm
Running approximate minimum spanning tree solver
Running nonlinear network flow optimizer
Maximum flow on network: 38
Number of nodes in network: 311342701
Flow increment: 1 (Total improvements: 0)
24 incremental costs clipped to avoid overflow (0.000%)
Treesize: 311342701 Pivots: 2978685093 Improvements: 12378833
Maximum flow on network: 3
Flow increment: 2 (Total improvements: 12378833)
Treesize: 311342701 Pivots: 315 Improvements: 0
Maximum flow on network: 3
Flow increment: 3 (Total improvements: 12378833)
Treesize: 311342701 Pivots: 2 Improvements: 0
Maximum flow on network: 3
Total solution cost: 2.41813966e+09
Integrating phase
Writing output to file UnwPhase_ifg_srd_IW3_VV_29Jul2015_15Sep2015.snaphu.img
Program snaphu done
Elapsed processor time: 319:53:42.61
Elapsed wall clock time: 441:22:54

real 26482m54.275s
user 19167m53.344s
sys 25m49.264s



So the process took 18+ days? :cold_sweat:

Is the end-result any good?


Hello, Giorgio,

This is crazy! Like I had done many years ago.
I think you have to apply low-coherence mask besides the sea mask you already applied.
There is code in ROI_pac you may have a try. It is no good even if you got everything optimized in snaphu, because some areas, such as layover, shadow regions cannot be well extracted from SAR data. Of course, some areas with temporal decorrelation is similar.

Another way is to undersample your data, using multi-look operations, which will certainly decrease the horizontal resolution of your final results. There is a smart way to increase this resolution, as done by Gamma RS, by using the undersampled results as model to unwrap the full resolution data. This is really time-consuming, as you already got a reliable unwrapping result.

I also found large memory machines under linux works very fast (windows is bad with same hardware), so you may also try to upgrade your computer memory. The SWAP space is quite slow for doing the job, that should be avoided.

Good luck!



With regards to DEM generation, I decided to use ALOS PALSAR SLC scenes and I’ve been getting better results due to a higher spatial resolution of the resulting DEM. The processing can be ran in Sentinel toolbox and the images are provided by free at Alaska Satellite Facility. I’ve been using Level 1.1 Complex data in CEOS format.
Good luck!


Thank you Jianbao for your comment.

I am surprised that SNAP masking operations applies only to DEM-based masks. Do you think that it would be easy to convert to mask a binary layer produced by band math operations on the coherence band? in the case, it would be easy to produce from coherence and apply to phase a mask in snap before importing the image in snaphu, without the necessity of external code…

Also, maybe tiling would be helpful in reducing memory usage. would you suggest it in snaphu? I found somewhere different opinions on tiling…

Thank you for your further suggestions



Hi, Giorgio,
You are absolutely right. I remember the Roi_pac software just works like that.
Because I never use the mask operation in SNAP, I am not sure what is exactly implemented.
But I think SNAP is very nice for conversion of data formats in different environment and different OS. So I can transfer files in different OS, or software, such as Gamma, Roi_pac, Matlab, ENVI, or ArcGIS. That’s to say, it would be very easy to make your own mask in any of the software.

About tiling, basically I also do not suggest such operations, as you would have many unwrapping errors at the overlap areas, and different tiles could be incompatible as well. Snaphu is a global optimization code based on PPD, so if you cut the images into pieces, you actually implement a non-global optimization any more.



Giorgio, the default land/sea mask uses a DEM because it’s very fast to check. However, you could also use your own shape file or as you suggested using band maths on the coherence.


Dear Iveci,

I was able to produce a raster based on bandmath operations on coherence, setting <<0>> values as no-data, but I still haven’t found the way to “promote” this generated layer to a mask-type layer, in order to apply such layer as a mask.

In fact, going to menu Raster -> Masks -> Mask Area, in the dialog the “select mask” selection windows is empty and there is no possibility to fill the space.

Any hint? Ty!



Being more informative,

creating a new image using the old bands (i, q, coh, intensity and phase) multiplied by coherence-based bandmath-created mask, is visually what i was looking for (NaNs in all low-coherence areas), but this new image is not accepted by the snaphu export procedure… (error: org.esa.snap.core.gpf.graph.GraphExeption)

The only difference is that, looking in layer properties, the units of Raster Band Properties are missing (real, imaginary,coherence, phase and intensity).

The only thing i can suspect is that Snaphu export looks for such labels in layer properties to select the correct bands… :disappointed:


Hello Friends!
Finally I got the results I was expecting. In fact the Sentinel DEM is better than I supposed it would be…
The only problem is that I had to use SARScape 5.3 (Exelis) in order to create the DEM…


well done Osvaldo,
anyway it is a pity that snap can’t handle it as well… :confused:



I am not aware of the processing procedure implemented in SARScape (which is a nice s/w as well), however, be aware that it is quite different to generate a DEM using SAR data from scratch and update the heights of an already existing DEM based on SAR.


Hi Guys,

as you said, the Sentinel-1 Toolbox updates the existing SRTM 3sec DEM …
Does anyone of you know how to use SRTM 1sec data as reference DEM? The Toolbox offers this option (unfortunatelly not as automatic Download) in the Range-Doppler-Terrain-Correction step. I downloaded the SRTM 1sec DEM for my area of interest via the USGS Explorer, but so far I couldn´t find out how to use it.



Dear osvaldoguax,
Is this area with many vegetation? What step do you use? Because I am using SAR with many vegetation area and the unwrapping phase process is never finished (it even already takes 1 month). Can you share to me how you do it?


Hello Marden. No. This area is covered by shrubs and some exposed rock fields. In addition, there are some areas of riparian forest along the surrounding of the drainage system. First think to see is the coherence image. If you have an average value above 0.45 that’s good. Values below 0.2 result in noisy phases. You might also analyze your resulting phase (Try to subset your data to areas with coherence above 0.25). If your algorithm is running for one month, I’m sure there is some problem with your phase. Worts the phase more time it takes to solve the wrapped phase. I’ve been using SARScape for this purpose… If you have the ENVI Exelis license, you might download and Install SARScape on the Exelis homepage. Anyway. ESA SNAP is a very good option… I know they are planning to integrate phase unwrapping on the interfarogram flowchart.
Hope that helps you and good luck. You might also try to explore other free global data that can be processed in ESA SNAP like ALOS PALSAR (Alaska Satellite Facility)…


We’re working now on the same, with SNAPHU compiled with CYGWIN in Windows 7 x 64. Use the tiling option with tiles 1024*1024 it works great with 8 Gb RAM, you can set in NPROC the number of cores present on your system. Set overlap to 0. SNAPHU then automatically assembles the tiles in a seamless file. We can process PALSAR-2 failes within 30-40 mn that way.


I have the following Alos Palsar 1.1 datas. I want to use it for DInsar, or Dem generation. Should I first apply orbit file? Or step by step which tutorial/and parameters should I follow to get a good result? thanks