looping over lines instead of reading the whole file
parent
fe097c906a
commit
08e3849945
|
@ -288,30 +288,19 @@ def remove_filter(intfile, filtfile, unwfile):
|
||||||
outunw = outunw[0] + outunw[1]
|
outunw = outunw[0] + outunw[1]
|
||||||
|
|
||||||
ds_unw = gdal.Open(unwfile + ".vrt", gdal.GA_ReadOnly)
|
ds_unw = gdal.Open(unwfile + ".vrt", gdal.GA_ReadOnly)
|
||||||
unw_phase = ds_unw.ReadAsArray()
|
width = ds_unw.RasterXSize
|
||||||
|
length = ds_unw.RasterYSize
|
||||||
|
|
||||||
bands, length, width = unw_phase.shape
|
unw_phase = np.memmap(unwfile, dtype='f', mode='r', shape=(2, length, width))
|
||||||
print(bands, length, width)
|
filt_phase = np.memmap(filtfile, dtype='f', mode='r', shape=(length, width))
|
||||||
outfile = IML.memmap(outunw, mode='write', nchannels=2,
|
int_phase = np.memmap(intfile, dtype='f', mode='r', shape=(length, width))
|
||||||
nxx=width, nyy=length, scheme='BIL', dataType='f')
|
|
||||||
|
|
||||||
outfile.bands[0][:, :] = unw_phase[0, :, :]
|
outfile = np.memmap(outunw, dtype='f', mode='w+', shape=(2, length, width))
|
||||||
|
|
||||||
ds_filt = gdal.Open(filtfile + ".vrt", gdal.GA_ReadOnly)
|
for line in range(length):
|
||||||
filt_phase = np.angle(ds_filt.ReadAsArray())
|
integer_jumps = unw_phase[1, line, :] - np.angle(filt_phase[line, :])
|
||||||
|
outfile[1, line, :] = integer_jumps + np.angle(int_phase[line, :])
|
||||||
integer_jumps = unw_phase[1, :, :] - filt_phase
|
outfile[0, line, :] = unw_phase[0, line, :]
|
||||||
|
|
||||||
del unw_phase, filt_phase
|
|
||||||
|
|
||||||
ds_int = gdal.Open(intfile + ".vrt", gdal.GA_ReadOnly)
|
|
||||||
int_phase = np.angle(ds_int.ReadAsArray())
|
|
||||||
|
|
||||||
out_phase = integer_jumps + int_phase
|
|
||||||
|
|
||||||
del int_phase, integer_jumps
|
|
||||||
|
|
||||||
outfile.bands[1][:, :] = out_phase[:, :]
|
|
||||||
|
|
||||||
unwImage = isceobj.Image.createImage()
|
unwImage = isceobj.Image.createImage()
|
||||||
unwImage.setFilename(outunw)
|
unwImage.setFilename(outunw)
|
||||||
|
@ -322,9 +311,7 @@ def remove_filter(intfile, filtfile, unwfile):
|
||||||
unwImage.scheme = 'BIL'
|
unwImage.scheme = 'BIL'
|
||||||
unwImage.dataType = 'FLOAT'
|
unwImage.dataType = 'FLOAT'
|
||||||
unwImage.setAccessMode('read')
|
unwImage.setAccessMode('read')
|
||||||
#unwImage.createImage()
|
|
||||||
unwImage.renderHdr()
|
unwImage.renderHdr()
|
||||||
#unwImage.finalizeImage()
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -334,9 +321,8 @@ def main(iargs=None):
|
||||||
'''
|
'''
|
||||||
|
|
||||||
inps = cmdLineParse(iargs)
|
inps = cmdLineParse(iargs)
|
||||||
interferogramDir = os.path.dirname(inps.intfile)
|
|
||||||
print ('unwrapping method : ' , inps.method)
|
print ('unwrapping method : ' , inps.method)
|
||||||
'''
|
|
||||||
if inps.method == 'snaphu':
|
if inps.method == 'snaphu':
|
||||||
if inps.nomcf:
|
if inps.nomcf:
|
||||||
fncall = runUnwrap
|
fncall = runUnwrap
|
||||||
|
@ -350,7 +336,6 @@ def main(iargs=None):
|
||||||
|
|
||||||
elif inps.method == 'icu':
|
elif inps.method == 'icu':
|
||||||
runUnwrapIcu(inps.intfile, inps.unwfile)
|
runUnwrapIcu(inps.intfile, inps.unwfile)
|
||||||
'''
|
|
||||||
|
|
||||||
if inps.rmfilter:
|
if inps.rmfilter:
|
||||||
filtfile = os.path.abspath(inps.intfile)
|
filtfile = os.path.abspath(inps.intfile)
|
||||||
|
|
Loading…
Reference in New Issue