Snaphu in macOX

Hi!

Anyone knows how to make snaphu work in macOX? What system variables do I need to add for the snaphu-unwrapping external tool?
I have an issue at the point of the snaphu-unwrapping, the system does nothing.
I have tried to download and compile snaphu from the strandford website. But still nothing. There is any configuration to make it work in SNAP, or does it needs to be executed separately?, in any case could anyone point me to the correct direction?

Hi! I assume you managed to compile snaphu on MacOS and can start it from the command line? If it does, you can run it either from SNAP or from the command line, depending on your preference, and someone else on the forum should be able to help you. And future plugin versions might bundle a MacOS binary (but I don’t have any insight into it).

Just a small note: you might run into some crashes because of a bug in the original code. We applied the following patch for the binaries we distribute:

diff --git a/src/snaphu_io.c b/src/snaphu_io.c
index 812b79b..cf4f2d1 100644
--- a/src/snaphu_io.c
+++ b/src/snaphu_io.c
@@ -17,12 +17,12 @@
 #include <float.h>
 #include <string.h>
 #include <ctype.h>
+#include <time.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/wait.h>
-#include <sys/time.h>
 #include <sys/resource.h>
 
 #include "snaphu.h"
diff --git a/src/snaphu_util.c b/src/snaphu_util.c
index bb1422d..c039f6c 100644
--- a/src/snaphu_util.c
+++ b/src/snaphu_util.c
@@ -16,12 +16,12 @@
 #include <float.h>
 #include <string.h>
 #include <ctype.h>
+#include <time.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/wait.h>
-#include <sys/time.h>
 #include <sys/resource.h>
 
 #include "snaphu.h"

Hi,
Regarding the configuration to make inside SNAP snaphu bundle, go to Tools -> Manage External Tools, select snaphu-unwrapping adapter, click on Edit button, on Bundled Binaries tab go to MacOSX Bundle tab and change the settings with something like this:

Also, because the bundle was build only for Windows and Linux, there is a small change to be done in System Variables tab, for SNAPHU_EXE variable value (you need the enter the executable file name):

Best regards,
Oana

Hi Oana,

Thanks for the replay, but I don’t understand one thing, mac does not have zip as default, in this case is a “tar.gz” compressed file, is that file the one I need to point to, in the local zip archive location? Also I tried to add the path for the installer file, and still does not work. Could be because in the “target folder” I cannot find the .snap library, so I don’t know which path I need to add there.
Where is the library folder “$HOME/.snap/auxdata” folder equivalent in MacOX?

BR,
David

This is my configuration


Hi Inicola

I think it is compiled, but when I launch snaphu in the terminal I got this


looks like it starts and stops. How do I unwrap in terminal?

BR
David

that means it is compiled correctly, but you have to enter the entire term which is given in the snaphu.conf file.
something like

snaphu -f snaphu.conf Phase_ifg_srp_09Jun2012_21Jun2012.snaphu.img 5328

and it should be executed in the folder where you exported the data from SNAP.

I can’t test right now, but you’ll need a configuration file. SNAP can generate one. See Radar / Interferometric / Unwrapping / snaphu Export. You can then take a look in that directory and launch it like @ABraun said. I think snaphu.conf will have a comment with the command line (for the linelength parameter, e.g. 5328).

OK, looks like SNAP creates a config file that I can actually call from terminal


and get the unwrapping phase completed

Thank you very much for the guidance.
If I am able to do it thru the terminal, is there any configuration for the SNAP interface that I can use, to have the same results?

BR,
David

1 Like

I’m happy to see that it works for you.

I recently compiled instructions on the installation and use of snaphu from within SNAP:
S1 IW InSAR tutorial

It is based on Windows but many of the hints are valid for all operating systems.

1 Like

Yes, that’s the tutorial I was following, well explained and well detailed. But in the section of the installation of snaphu, as you said, it was focus on windows.(I could make it work, in my other windows machine) but for MacOS, the bundle binaries are in blank, and I don’t know what to add there.

oh, I see. I currently don’t have the chance to test on MacOS, sorry.

No worries, it’s a “nice to have”. MacOS users can still do the unwrapping phase via terminal.