Filter out low coherence pixels before phase unwrapping

Dear all,

I had been desperately struggling with this problem for several months until my dear colleague @constantinevi taught me how to do this. Therefore, I produce a detailed tutorial on this topic under his kind permission, and I hope it will be helpful for those in need.

Here is the link where I demonstrate the comparison of the results applied and not applied the coherence threshold.

Any insight and suggestions are welcome! Thanks a lot.

Yen Yi


Thank you for creating these instructions! I’m sure this is useful to many users.

1 Like

Thank you, Yen Yi.

I’m very happy to be a contributor of your tutorial and helping other users in this forum.
Also, if you encounter any other problems, I would always be happy to help you.


I am sure there could be a way to include this in the official repository of SNAP ESA tutorials. (


Yes, at the bottom of the page you can submit a tutorial. After review it might be included in the list of tutorials.


Just small remark - in the text describing BandMath expression you put NaN while on the
picture I see zero value (0). Since 0 is accepted value for the phase band I guess NaN is the correct value.

1 Like

@qglaude @marpet thank you for providing this information. After the discussion, @constantinevi and I decide to make a video and provide it to ESA.

@hriston_bg I think in both of my text descriptions as well as my figure, I expressed that we should replace the values under the threshold with zero. This is because we noticed that snaphu is unable to unwrap “NaN” pixels.

However, I also understand your point. To experiment, you can try to geocode the interferogram which has been filtered out low coherence pixels. You will find out that the pixels with zero value are turned into “NaN” in the geocoded product.

I suppose that although “zero” in the interferogram is an accepted value, it symbolizes no data value in a sense. I don’t know the actual mechanism so it is just my assumption. If anyone knows better than me, please feel free to correct me. I’d be very much appreciated. :slight_smile:

Lastly, I finished the post of my experiment on the comparison of different coherence thresholds applied. Please check this link if you are interested in my experiment.

Again, any insight and suggestions are welcome! Thanks a lot.

@tsum_yenyi Thank you for being kind to make this larger explanation. The second clarification and the results you provided are quite convincing. And just a suggestion - I guess a written tutorial shall be easier to follow than a video (this is just my own opinion).

Here comes a question to the SNAP development team with regard why the 0 values turn into NaN after geocoding. May be @marpet or @ABraun could help in this.

Regarding the second issue I’d be happy to read a paper or book chapter where the unwrapping with 0’s and NaN’s are discussed. I’m aware just about the basics of the unwrapping procedure, but in depth discussion might be better to read.

The NaN and zero issue I can’t explain. Honestly, I do not really understand what the issue is. :slight_smile:
Maybe @jun_lu or @lveci can? Or can you @ABraun?

Just a general remark in this direction.
If a value is marked as no-data, either by the bands no-data value (other call it fill value) or by an expression then those values are replaced by NaN when doing a reprojection.

@marpet I was just wondering if the unwrapping procedure could accept NaN’s and what the difference could make. You last remark answers my question - thank you.

@tsum_yenyi is talking about the 0 value in phase band will change to NaN after terrain correction. However, I think it is not really a issue as the phase equal to 0 always happen in the edge of the interferogram while the master and slave image are in different size. I guess the developers deal these pixel in 0 phase as NoData to avoid the error result (like phase in 0) at boundary of the raster result.

After turning the low coherence areas to zero in the interferogram, you have to make sure that the nodata option is disabled in the band properties. Otherwise it will be turned to nodata in the next processing step (here Terrain Correction). Probably also “Mask out areas without elevation” can be disabled to go sure.