Error to unwrap phase with SNAPHU


I am working on a Windows machine and trying to run phase unwrapping on a S1 scene. I have run already the SNAPHU export operator to generate the files.

Next, I open cmd, change directory to the folder shown in the pic above and run the command found in snaphu.conf

snaphu -f snaphu.conf Phase_ifg_IW1_VV_16Jan2016_04Jan2016.snaphu.img 21667

I am getting an error right after starting the process:


Any idea what is causing the error? As far as I know I am proceeding properly.


the file says VH but the config file contains VV.

I recommend to only use VV at the TOPS Split process to avoid these errors. Also, VH interferograms are sometimes of lower coherence.

1 Like

indeed, just realized about it. Until the snaphu export, i did not select any polarization so I thought both VV and VH would be exported for phase unwrapping. Actually, if I check the bands available in the filtered inferferogram (the last product before snaphu export), I can see both VV and VH in the bands folder


What if I would want to unwrap VH for comparison purposes ? How can I get snaphu to export the files for VH?

I recommend to process VH and VV separately then from the beginning. Or at least use the Band Select operator (under Raster) to limit the generation of the interferogram to one of both polarizations.
Would be interested in the difference of VH and VV interferograms too.

thanks for the hint :grinning:

Just tried again, only selecting VV in the Split operator. Now I am getting:

Not sure what would be the problem here. I assume it is related to the coherence file but actaully I cannot see the coh.... file in the folder

These are the parameters I set when doing snaphu export

I put the number of tiles to 1 as I am working on a small area and I would prefer not to split the product to avoid errors when merging afterwards.

I set row and column overlap to 0 as I have set the tile to 1 so no need to define an overlap area.

please make sure that you included coherence estimation in the interferogram step before you run the snaphu export-

It is checked in the operator and as true in the xml (I am running using gpt).


If i open the output product of that graph, in the bands folder I can see coherence:


I have re-run the graph again to make sure and still the same output regarding snaphu export

This would have been good to know from the beginning :wink:
Do you run the snaphu export also via the gpt?

yes, also tried just now via the GUI and same behaviour, snaphu export is not putting the coherence file in the folder.

@ABraun seems the issue was previously reported:

I can confirm the solution proposed by @panjibrotoisworo works. Now snaphu has included the coh.... file

I am writing down the full things of snaphu -

le 1024 -c corrfile

   Unwrap the input interferogram by minimizing the unweighted congruent L2 norm:

        snaphu -p 2 -n wrappedfile 1024

   Unwrap the interferogram as a three-by-four set of tiles that overlap by 30  pixels,  with
   the specified configuration file, using two processors:

        snaphu wrappedfile 1024 -f configfile \
             --tile 3 4 30 30 --nproc 2

The program may print a warning message about costs being clipped to avoid overflow. If
too many costs are clipped, the value of COSTSCALE may need to be decreased in a
configuration file (via the -f option). If the program prints a warning message about an
unexpected increase in the total solution cost, this is an indication that too many costs
are clipped. It is usually okay if just a few costs are clipped.

   In  topography  mode,  if  the  unwrapped  result  contains  too many discontinuities, try
   increasing the value of  LAYMINEI  or  decreasing  the  value  of  LAYCONST.   The  former
   determines  the normalized intensity threshold for layover, and the latter is the relative
   layover probability.  If there are  too  many  discontinuities  running  in  azimuth,  try
   decreasing the value of AZDZFACTOR, which affects the ratio of azimuth to range costs.  If
   the baseline is not known, take a guess at it and be sure its sign  is  correct.   Specify
   the  SAR  imaging  geometry  parameters as well as possible.  The defaults assume ERS data
   with five looks taken in azimuth.

   In deformation mode, if the  unwrapped  result  contains  too  many  discontinuities,  try
   increasing  the  value  of  DEFOTHRESHFACTOR or decreasing the value of DEFOCONST.  If the
   surface displacement varies slowly and true  discontinuities  are  not  expected  at  all,
   DEFOMAX_CYCLE  can be set to zero.  This behavior is also invoked with the -s option.  The
   resulting cost functions will be similar to correlation-weighted L2 cost functions, though
   the  former  are  not  necessarily centered on the wrapped gradients.  Congruence is still
   enforced during rather than after optimization.

   The program can be run in initialize-only (-i) mode for quick down-and-dirty  MST  or  MCF

Once the iterative solver has started, snaphu traps the interrupt (INT) and hangup and related. Between all of these parameters I have used erp systems and related things. (HUP)
signals. Upon receiving an interrupt, for example if the user types Ctrl-C, the program
finishes a minor iteration, dumps its current solution to the output, and exits. If a
second interrupt is given after the first (caught) interrupt, the program exits
immediately. If a hangup signal is received, the program dumps its current solution then
continues to execute normally.

Upon successful termination, the program exits with code 0. Errors result in exit code 1.

The following files may be useful for reference, but are not required. They are included
in the program source distribution and may be installed somewhere on the system.

          Template  configuration file setting all valid input parameters (though some may be
          commented out).

          General-purpose template configuration file setting the most important or  commonly
          modified input parameters. In  addition  to  parameters  read from configuration files specified on the command line,
   default parameters may be read from a system-wide configuration file if  such  a  file  is
   named when the program is compiled.

The -w option has not been tested exhaustively.

   Extreme  shadow  discontinuities  (i.e., abrupt elevation drops in increasing range due to
   cliffs facing away from the radar) are not modeled that well in  the  cost  functions  for
   topography mode.

   Abrupt  changes  in  surface reflectivity, such as those of coastlines between bright land
   and dark water, might be misinterpreted as layover and assigned inappropriate costs.

   The algorithm's  behavior  may  be  unpredictable  if  the  costs  are  badly  scaled  and
   excessively clipped to fit into their short-integer data types.

   There  is  no  error  checking  that  ensures that the network node potentials (incost and
   outcost) do not overflow their long-integer data types.

   Automatic flow clipping is built into the MST initialization,  but  it  can  give  erratic
   results  and  may  loop infinitely for certain input data sets.  It is consequently turned
   off by default.

   Dedicated programs for specific Lp objective functions may work better than snaphu  in  Lp
   mode.   Note that snaphu enforces congruence as part of the problem formulation, however,
   not as a post-optimization processing step.

Hope this article helps everyone properly.