Need to mask phase and coherence for unwrapping (coherence > 0.2)

I am using Band Math in SNAP after golstein filtering to calculate phase new band with coherence > 0.2 using expression (if coherence < 0.2 then 0 else phase) and exporting for snaphu applying phase unwrapping but cannot unwrap for new calculated phase band getting error below
Unexpected or abnormal exit of child process 2534
phase unwrapping running ok on phase without mask.
Please guide i need to mask phase with coherence > 0.2 and run unwrap afterwards, search all through forum but not able to find solution

A similar topic was opened a few days ago.

In your case the unwrapping is disturbed by the 0 values in your raster because they are not interpreted as no-data-values.
Why not unwapping the whole image and excluding the low coherence areas afterwards?

Unwrapping noise can take a very long time and the result is in any case useless…

still better than having no result due to the zeroes :slight_smile:

Or do you know a workaround?

It take very long time, useless to unwrap noisy pixels

I did option mask by polygon, snap masked it and process run successfully but geocoded image do not exactly overlap the polygon use to mask it

at which step did you perform geocoding?
Importng a vector in a slant range image is prone to smaller geometric errors.

snaphu has the option to generate a maskfile based on the unwrapping costs which can then be used for extracting noisy areas:
https://web.stanford.edu/group/radar/softwareandlinks/sw/snaphu/snaphu_man1.html

I didn’t try it so far but maybe it removes the bad quality areas as you originally intended.

-g maskfile
Grow a connected component mask for the unwrapped solution and write the mask to the file maskfile. A connected component is a region of pixels in the solution that is believed to have been unwrapped in a relative, internally self-consistent manner according to the statistical costs used. Regions that are smaller than a preselected threshold are masked out. Parameters for this option can be set in the configuration file. The connected component file is composed of unsigned characters, with all pixels of the same value belonging to the same connected component and zero corresponding to masked pixels.

After golstein filtering did geocoding generate vector for coherence > 0.2 import in snap mask the product and export it for snaphu did unwrapping then geocode unwrap product result is not overlapping with masked polygon.
do not know snaphu option -g maskfile not familiar

geocoding is usually done at the very end of a SAR analysis, at least for interferometric and polarimetric approaches.
You can directly digitize a vector in SNAP and use if for the mask process:

  • Digitize a polygon around your area of interest and save your product.
  • Use the Land/Sea mask module to clip out this area: Instead of masking the land or sea, use the third option where your geometry is used as the mask extent.
  • Run the snaphu export again with your masked product.
1 Like

Digitizing area with coherence > 0.2 is almost impossible

If we can convert raster of coherence > 0.2 into vector within SNAP?

Thanks i did it using magic wand tool mask roi in snap

Hi all! Not sure if this would be helpful to anyone but I managed to mask the Phase for unwrapping using the following method:

Right click on the Phase band and select Properties, then in the Valid-Pixel Expression box put in the following expression: if coh* > 0.5 then Phase* else 0. Make sure that your coh and Phase bands actually have the right names. I constructed the expression using band math and then copied it out and put it into the Valid-Pixel Expression box. Then I right clicked on the phase band and converted it from a virtual to a real band (Convert Band). For good measure I saved the product, removed it from SNAP and put it back in and then used the Snaphu Export tool.

5 Likes