Coherence Mask/Threshold for Unwrapping

Hello.

I’ve been trying a few things with Snaphu export, and I’ve been confronted to a few problems with the results. When working with a small area, the results are very good, but when I try to unwrap a whole subswath with lox coherence areas, Snaphu starts mixing things up and unwraps completly incoherent areas, resulting in smooth interferogram with huge displacements.

I would like to try to unwrap with a mask applied on those low coherence areas, I know it is possible to do it as GMTSAR does it, but I can’t find a way to do it with Snap. I have two options, but I can’t find a way for either of them :
1- Applying a msk directly on my Interferogram ;
or
2 - Joining a mask file to snaphu processing (like GMTSAR does).

Has anyone a clue to apply that kind of mask ?

Thanks in advance.

1 Like

the Goldstein phase filter has a checkbox for masking coherence and a field where you can define a threshold. But I’m not sure if it really masks the product or if this only affects the performance of the filter.

I’m afraid the latter is the case:
Unfiltered - Filtered - Coherence

Thank you for your anwser.

Yes, I tried this option, and as you said it affects the filtering processing step.
But when I look at my snaphu.conf file, the coherence file is mentionned, but no settings are available for setting a threshold.

Update :
I’ve been investigating on what’s happening with GMTSAR, because I don’t see an option in Snaphu to set a coherence threshold. It calls snaphu via a C-Shell script called snaphu.csh
In it, you can find the GMT command :

gmt grdmath corr_patch.grd $1 GE 0 NAN mask_patch.grd MUL = mask2_patch.grd
($1 corresponding to an input threshold value)

While I’m really not confortable with C-Shell or GMT, it seems that replacing values with NaN could work as a coherence mask, but is there a way to do it via SNAP ?

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?
Cheers,


Marjan

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

Hi,
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

Hi,
Do you have an idea what might be the problem ?
Thanks

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)

Thanks

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.