Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fringe/Snaphu output for Mintpy #46

Closed
stoormgeo opened this issue Jul 20, 2021 · 9 comments
Closed

Fringe/Snaphu output for Mintpy #46

stoormgeo opened this issue Jul 20, 2021 · 9 comments

Comments

@stoormgeo
Copy link

Hi
Has anyone tried using the non built-in snaphu for imports into mintpy?
I processed the interferograms with the latest version of snaphu (2.0.4) but got an corrupted images.
Used snaphu (tested with/without tile mode) + make xml and vrt with custom script from isce2 pkgs.
The images processed with build-in snaphu from isce2 packages looks correct.
Playing with different snaphu options (data formats, uwrapping modes etc) with no effect.

snaphu -v -S -f merged/fringe/PS_DS/snaphu.conf 20200505_20200809.int 3419 -c merged/fringe/PS_DS/tcorr_ds_ps.bin -o 20200505_20200809.unw --tile 10 5 200 200 --nproc 20

Corrupted
Correct

@hfattahi
Copy link
Contributor

Could you check the size of the unwrapped interferogram from two snaphu runs? Are they the same size?

@stoormgeo
Copy link
Author

Could you check the size of the unwrapped interferogram from two snaphu runs? Are they the same size?

Checked. The same size.

@hfattahi
Copy link
Contributor

Could you check the size of the unwrapped interferogram from two snaphu runs? Are they the same size?

Checked. The same size.

May I ask how many bytes are they?

@stoormgeo
Copy link
Author

Could you check the size of the unwrapped interferogram from two snaphu runs? Are they the same size?

Checked. The same size.

May I ask how many bytes are they?

Snaphu output tiles mode
[insar@osllnx07 unw]$ stat 20200505_20200809.unw
File: ‘20200505_20200809.unw’
Size: 252431608 Blocks: 493032 IO Block: 4096 regular file
[insar@osllnx07 unw]$ stat 20200505_20200809.unw.conncomp
File: ‘20200505_20200809.unw.conncomp’
Size: 31553951 Blocks: 61632 IO Block: 4096 regular file

Built-in snaphu
[insar@osllnx07 old]$ stat 20200505_20200809.unw
File: ‘20200505_20200809.unw’
Size: 252431608 Blocks: 493032 IO Block: 4096 regular file
[insar@osllnx07 old]$ stat 20200505_20200809.unw.conncomp
File: ‘20200505_20200809.unw.conncomp’
Size: 31553951 Blocks: 61632 IO Block: 4096 regular file

@stoormgeo
Copy link
Author

stoormgeo commented Jul 21, 2021

@hfattahi,
As Scott wrote in #21 (comment), this could be a wrong width issue.
Is it an issue in my script for make xml and vrt files in this case? However, I successfully checked it on data from the built-in snaphu also.
My script code:

import os
import argparse
from osgeo import gdal
import isce
import isceobj

def cmdLineParser():
'''
Command line parser.
'''

parser = argparse.ArgumentParser(description = 'Make metafiles for external unwrapped data',
            formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-i', '--unwrap_file', type=str, dest='unwrapFile',
        required=True, help='input unwrapped file')
parser.add_argument('-m', '--metadata file', type=str, dest='interferogramFile',
        required=True, help='Input interferogram file for existing metadata')

return parser.parse_args()

def write_xml(fileName,width,length,bands,dataType,scheme):

img = isceobj.createImage()
img.setFilename(fileName)
img.setWidth(width)
img.setLength(length)
img.setAccessMode('READ')
img.bands = bands
img.dataType = dataType
img.scheme = scheme
img.renderHdr()
img.renderVRT()

return None

def getSize(data):

ds = gdal.Open(data, gdal.GA_ReadOnly)
length = ds.RasterYSize
width = ds.RasterXSize
ds = None
return length, width

if name == 'main':
'''
Main driver.
'''
#*************************************************************#
inps = cmdLineParser()
length, width = getSize(inps.interferogramFile)
print("length, width: ", length , " ", width)

write_xml(inps.unwrapFile, width, length, 2 , "FLOAT", "BIL")                                                                                                                                                                                           
# uncomment if you need to generate xml and vrt for conncomp
# write_xml(inps.unwrapFile+'.conncomp', width, length, 1, "BYTE", "BIP")

@hfattahi
Copy link
Contributor

Could you check the size of the unwrapped interferogram from two snaphu runs? Are they the same size?

Checked. The same size.

May I ask how many bytes are they?

Snaphu output tiles mode
[insar@osllnx07 unw]$ stat 20200505_20200809.unw
File: ‘20200505_20200809.unw’
Size: 252431608 Blocks: 493032 IO Block: 4096 regular file
[insar@osllnx07 unw]$ stat 20200505_20200809.unw.conncomp
File: ‘20200505_20200809.unw.conncomp’
Size: 31553951 Blocks: 61632 IO Block: 4096 regular file

Built-in snaphu
[insar@osllnx07 old]$ stat 20200505_20200809.unw
File: ‘20200505_20200809.unw’
Size: 252431608 Blocks: 493032 IO Block: 4096 regular file
[insar@osllnx07 old]$ stat 20200505_20200809.unw.conncomp
File: ‘20200505_20200809.unw.conncomp’
Size: 31553951 Blocks: 61632 IO Block: 4096 regular file

Thanks for checking the size. Obviously they are identical.

@hfattahi
Copy link
Contributor

@hfattahi,
As Scott wrote in #21 (comment), this could be a wrong width issue.
Is it an issue in my script for make xml and vrt files in this case? However, I successfully checked it on data from the built-in snaphu also.
My script code:

import os
import argparse
from osgeo import gdal
import isce
import isceobj

def cmdLineParser():
'''
Command line parser.
'''

parser = argparse.ArgumentParser(description = 'Make metafiles for external unwrapped data',
            formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-i', '--unwrap_file', type=str, dest='unwrapFile',
        required=True, help='input unwrapped file')
parser.add_argument('-m', '--metadata file', type=str, dest='interferogramFile',
        required=True, help='Input interferogram file for existing metadata')

return parser.parse_args()

def write_xml(fileName,width,length,bands,dataType,scheme):

img = isceobj.createImage()
img.setFilename(fileName)
img.setWidth(width)
img.setLength(length)
img.setAccessMode('READ')
img.bands = bands
img.dataType = dataType
img.scheme = scheme
img.renderHdr()
img.renderVRT()

return None

def getSize(data):

ds = gdal.Open(data, gdal.GA_ReadOnly)
length = ds.RasterYSize
width = ds.RasterXSize
ds = None
return length, width

if name == 'main':
'''
Main driver.
'''
#*************************************************************#
inps = cmdLineParser()
length, width = getSize(inps.interferogramFile)
print("length, width: ", length , " ", width)

write_xml(inps.unwrapFile, width, length, 2 , "FLOAT", "BIL")                                                                                                                                                                                           
# uncomment if you need to generate xml and vrt for conncomp
# write_xml(inps.unwrapFile+'.conncomp', width, length, 1, "BYTE", "BIP")

Your script looks fine to me. Have you checked what is written differently to your "20200505_20200809.unw.xml" between the two runs?

@stoormgeo
Copy link
Author

@hfattahi,
As Scott wrote in #21 (comment), this could be a wrong width issue.
Is it an issue in my script for make xml and vrt files in this case? However, I successfully checked it on data from the built-in snaphu also.
My script code:
import os
import argparse
from osgeo import gdal
import isce
import isceobj
def cmdLineParser():
'''
Command line parser.
'''

parser = argparse.ArgumentParser(description = 'Make metafiles for external unwrapped data',
            formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-i', '--unwrap_file', type=str, dest='unwrapFile',
        required=True, help='input unwrapped file')
parser.add_argument('-m', '--metadata file', type=str, dest='interferogramFile',
        required=True, help='Input interferogram file for existing metadata')

return parser.parse_args()

def write_xml(fileName,width,length,bands,dataType,scheme):

img = isceobj.createImage()
img.setFilename(fileName)
img.setWidth(width)
img.setLength(length)
img.setAccessMode('READ')
img.bands = bands
img.dataType = dataType
img.scheme = scheme
img.renderHdr()
img.renderVRT()

return None

def getSize(data):

ds = gdal.Open(data, gdal.GA_ReadOnly)
length = ds.RasterYSize
width = ds.RasterXSize
ds = None
return length, width

if name == 'main':
'''
Main driver.
'''
#*************************************************************#
inps = cmdLineParser()
length, width = getSize(inps.interferogramFile)
print("length, width: ", length , " ", width)

write_xml(inps.unwrapFile, width, length, 2 , "FLOAT", "BIL")                                                                                                                                                                                           
# uncomment if you need to generate xml and vrt for conncomp
# write_xml(inps.unwrapFile+'.conncomp', width, length, 1, "BYTE", "BIP")

Your script looks fine to me. Have you checked what is written differently to your "20200505_20200809.unw.xml" between the two runs?

Сhecked, but everything is the same.
[insar@osllnx07 old]$ diff -s /data/insar/Proc/merged/fringe/PS_DS/old/20200505_20200809.unw.vrt /data/insar/Proc/merged/fringe/PS_DS/unw/20200505_20200809.unw.vrt
Files /data/insar/Proc/merged/fringe/PS_DS/old/20200505_20200809.unw.vrt and /data/insar/Proc/merged/fringe/PS_DS/unw/20200505_20200809.unw.vrt are identical

Here only path differ
[insar@osllnx07 unw]$ diff -s /data/insar/Proc/merged/fringe/PS_DS/old/20200505_20200809.unw.xml /data/insar/Proc/merged/fringe/PS_DS/unw/20200505_20200809.unw.xml
80c80
/data/insar/Proc/merged/fringe/PS_DS/old/20200505_20200809.unw

/data/insar/Proc/merged/fringe/PS_DS/unw/20200505_20200809.unw

@stoormgeo
Copy link
Author

Solved. Need to specify width instead of length in snaphu string in my case.
@hfattahi Do i need include script to the master branch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants