Coherence Mask/Threshold for Unwrapping

Try modify snaphu input coherent file by other program (gdal, sagagis qgis) resest less than threshold values nan . thats do this grtmath command. By SNAP bandmath should be also possible, but I am not sure that modified coherent file will be implimented to snaphu export

Thanks for your anwser.

I tried BandMath, but I can’t overwrite my coherence band with it, and the SnaphuExport tool does only select original coherence band. I tried duplicating and replacing my coherence band with this corrected band, but SnaphuExport then points me to a “null” error.

I’ll try to see what I can do to edit the snaphu files directly, with QGis or other software you suggested, and keep this topic updated.

Update :
Welp, I successfully set a threshold on my coherence band with Snap, and exported it with the Snaphu tool, but Sanphu processing fails when trying to unwrap… I’m out of ideas for setting a threshold with snap.

try put less than threshold values not Nan but zero

I tried, but unfortunately Snaphu still unwraps the area (so I’m wondering why does it need coherence) :confused:

Dear Nicolas,
I want to mask out areas with coherence lower than, say 0.4, in my coherence result and then try to do unwrapping. I think you used BandMath. I want to use it as well but I do not know what can I do?


I would use the ‘valid pixel expression’ definiton in the band properties. For example:
coh_HH_11Feb2008_04Mar2008 > 0.4

If you want to calculate a new raster you can also do it in the band maths:
if coh_HH_11Feb2008_04Mar2008 < 0.4 then 0 else Phase_xx

Did someone manage to unwrap the phase after applying this a coherence mask
if coh_HH_11Feb2008_04Mar2008 < 0.4 then 0 else Phase_xx

I got different problems: or I have two phases, or if the snaphu work, I can’t import because I already have the i band (when I import the wrap phase) …

Thank you for the help

why do you have two phases?

The second is the one created with the bandmaths, it is not overwritting the phase

Do you have an idea what might be the problem ?

sorry, I still don’t understand what you are doing. Why the band math? Which errors exactly occur?

I am trying to apply a coherence mask before unwrapping my interferogram with SNAPHU.
When I only change the valid pixel expression with coh > 0.2, I see it work on SNAP but it does not stay for SNAPHU.
So I tried to create a new phase band using this expression if coh_HH_11Feb2008_04Mar2008 < 0.4 then 0 else Phase_xx.
But then I got one band with the original phase and one with the coherence mask on.
I can do snaphu export when I do that, I manage to have snaphu working. But for the snaphu import I got two errors:
or it can’t read the unwrapped phase or it is saying when I add the wrapped phase that already a i_band exist. (depending on the name of for the phases I leave)


any chance that you open the unwrapped interferogram with the File > Open > select the hdr file
So you can have a look at the band and once you can maybe enter it in the snaphu import from the drop down menu.

When I open it like that I got: no matching ENVI image file for header file

is there a img file with the same name as the hdr created during the snaphu process?

Kind of. I don’t know why but the hdr has the correct name but the img created has the name of the other phase. So I modify the name in the header thinking that it will work…
Is there a way to copy a band in one product with its value and no the equation creating each value. Hope I am clear.
like that I could delete the first phase and it should work.

I guess snaphu just takes the original phase instead.
If both products have the same extents and pixel numbers you can address the bands of other products in the band maths dialogue.

like invert the value of each band in the bandmaths ? I am not sure I understand
I try to change the value, exchange the name but it doesnot work for snaphu .

what happens if you delete the original phase before exporting? Of course the phase from band maths should then be renamed accordingly.

That is why I ask if I can copy the band with its values. If I delete the original band the new one does not work because its values are linked with the original band