Merge pull request #276 from yunjunz/offset
cuDenseOffsets.prep*Geom*: supp. full-reso file w/o .full in the nameLT1AB
commit
a976d12c51
|
@ -40,6 +40,8 @@ def createParser():
|
|||
help='Reference image')
|
||||
parser.add_argument('-s', '--secondary',type=str, dest='secondary', required=True,
|
||||
help='Secondary image')
|
||||
parser.add_argument('--fix-xml','--fix-image-xml', dest='fixImageXml', action='store_true',
|
||||
help='Fix the image file path in the XML file. Enable this if input files havee been moved.')
|
||||
|
||||
parser.add_argument('--op','--outprefix','--output-prefix', type=str, dest='outprefix',
|
||||
default='offset', required=True,
|
||||
|
@ -166,6 +168,7 @@ def estimateOffsetField(reference, secondary, inps=None):
|
|||
return 0
|
||||
|
||||
# update file path in xml file
|
||||
if inps.fixImageXml:
|
||||
for fname in [reference, secondary]:
|
||||
fname = os.path.abspath(fname)
|
||||
img = IML.loadImage(fname)[0]
|
||||
|
@ -382,14 +385,24 @@ def prepareGeometry(full_dir, out_dir, x_start, y_start, x_step, y_step, num_win
|
|||
x/y_step - int, output pixel step in column/row direction
|
||||
num_win_x/y - int, number of columns/rows
|
||||
"""
|
||||
full_dir = os.path.abspath(full_dir)
|
||||
out_dir = os.path.abspath(out_dir)
|
||||
|
||||
# grab the file extension for full resolution file
|
||||
full_exts = ['.rdr.full','.rdr'] if full_dir != out_dir else ['.rdr.full']
|
||||
full_exts = [e for e in full_exts if os.path.isfile(os.path.join(full_dir, '{f}{e}'.format(f=fbases[0], e=e)))]
|
||||
if len(full_exts) == 0:
|
||||
raise ValueError('No full resolution {}.rdr* file found in: {}'.format(fbases[0], full_dir))
|
||||
full_ext = full_exts[0]
|
||||
|
||||
print('-'*50)
|
||||
print('generate the corresponding multi-looked geometry datasets using gdal ...')
|
||||
in_files = [os.path.join(full_dir, '{}.rdr.full'.format(i)) for i in fbases]
|
||||
# input files
|
||||
in_files = [os.path.join(full_dir, '{f}{e}'.format(f=f, e=full_ext)) for f in fbases]
|
||||
in_files = [i for i in in_files if os.path.isfile(i)]
|
||||
if len(in_files) == 0:
|
||||
raise ValueError('No full resolution geometry file found in: {}'.format(full_dir))
|
||||
|
||||
fbases = [os.path.basename(i).split('.')[0] for i in in_files]
|
||||
|
||||
# output files
|
||||
out_files = [os.path.join(out_dir, '{}.rdr'.format(i)) for i in fbases]
|
||||
os.makedirs(out_dir, exist_ok=True)
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ noMCF = 'False'
|
|||
defoMax = '2'
|
||||
maxNodes = 72
|
||||
|
||||
|
||||
def createParser():
|
||||
parser = argparse.ArgumentParser( description='Preparing the directory structure and config files for stack processing of StripMap data')
|
||||
|
||||
|
@ -102,6 +103,7 @@ def createParser():
|
|||
parser.add_argument('--summary', dest='summary', action='store_true', default=False, help='Show summary only')
|
||||
return parser
|
||||
|
||||
|
||||
def cmdLineParse(iargs = None):
|
||||
parser = createParser()
|
||||
inps = parser.parse_args(args=iargs)
|
||||
|
@ -136,11 +138,11 @@ def get_dates(inps):
|
|||
secondaryDates.remove(inps.referenceDate)
|
||||
return acuisitionDates, inps.referenceDate, secondaryDates
|
||||
|
||||
|
||||
def slcStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs, splitFlag=False, rubberSheet=False):
|
||||
# A coregistered stack of SLCs
|
||||
i=0
|
||||
|
||||
|
||||
if inps.bbox:
|
||||
i+=1
|
||||
runObj = run()
|
||||
|
@ -149,7 +151,6 @@ def slcStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs,
|
|||
runObj.crop(acquisitionDates, config_prefix, native=not inps.zerodop, israw=not inps.nofocus)
|
||||
runObj.finalize()
|
||||
|
||||
|
||||
i+=1
|
||||
runObj = run()
|
||||
runObj.configure(inps, 'run_{:02d}_reference'.format(i))
|
||||
|
@ -235,11 +236,11 @@ def slcStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs,
|
|||
|
||||
return i
|
||||
|
||||
|
||||
def interferogramStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs):
|
||||
# an interferogram stack without ionosphere correction.
|
||||
# coregistration is with geometry + const offset
|
||||
|
||||
|
||||
i = slcStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs, splitFlag=False, rubberSheet=False)
|
||||
|
||||
i+=1
|
||||
|
@ -249,6 +250,8 @@ def interferogramStack(inps, acquisitionDates, stackReferenceDate, secondaryDate
|
|||
low_or_high = "/"
|
||||
runObj.igrams_network(pairs, acquisitionDates, stackReferenceDate, low_or_high, config_prefix)
|
||||
runObj.finalize()
|
||||
return
|
||||
|
||||
|
||||
def interferogramIonoStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs):
|
||||
|
||||
|
@ -297,9 +300,10 @@ def interferogramIonoStack(inps, acquisitionDates, stackReferenceDate, secondary
|
|||
config_prefix = 'config_iono_'
|
||||
lowBand = '/LowBand/'
|
||||
highBand = '/HighBand/'
|
||||
runObj.dispersive_nonDispersive(pairs, acquisitionDates, stackReferenceDate,
|
||||
lowBand, highBand, config_prefix)
|
||||
runObj.dispersive_nonDispersive(pairs, acquisitionDates, stackReferenceDate, lowBand, highBand, config_prefix)
|
||||
runObj.finalize()
|
||||
return
|
||||
|
||||
|
||||
def main(iargs=None):
|
||||
|
||||
|
@ -330,7 +334,7 @@ def main(iargs=None):
|
|||
runDir = os.path.join(inps.workDir,'run_files')
|
||||
os.makedirs(runDir, exist_ok=True)
|
||||
|
||||
if inps.sensor.lower() == 'uavsar_stack': # don't try to calculate baselines for UAVSAR_STACK data
|
||||
if inps.sensor and inps.sensor.lower() == 'uavsar_stack': # don't try to calculate baselines for UAVSAR_STACK data
|
||||
pairs = selectPairs(inps,stackReferenceDate, secondaryDates, acquisitionDates,doBaselines=False)
|
||||
else:
|
||||
pairs = selectPairs(inps,stackReferenceDate, secondaryDates, acquisitionDates,doBaselines=True)
|
||||
|
@ -355,11 +359,9 @@ def main(iargs=None):
|
|||
|
||||
elif inps.workflow == 'ionosphere':
|
||||
interferogramIonoStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs)
|
||||
return
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# Main engine
|
||||
main()
|
||||
|
||||
|
||||
main(sys.argv[1:])
|
||||
|
|
Loading…
Reference in New Issue