parent
def109815d
commit
e712ca358c
|
@ -26,6 +26,7 @@ noMCF = 'False'
|
||||||
defoMax = '2'
|
defoMax = '2'
|
||||||
maxNodes = 72
|
maxNodes = 72
|
||||||
|
|
||||||
|
|
||||||
def createParser():
|
def createParser():
|
||||||
parser = argparse.ArgumentParser( description='Preparing the directory structure and config files for stack processing of StripMap data')
|
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')
|
parser.add_argument('--summary', dest='summary', action='store_true', default=False, help='Show summary only')
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
def cmdLineParse(iargs = None):
|
def cmdLineParse(iargs = None):
|
||||||
parser = createParser()
|
parser = createParser()
|
||||||
inps = parser.parse_args(args=iargs)
|
inps = parser.parse_args(args=iargs)
|
||||||
|
@ -136,11 +138,11 @@ def get_dates(inps):
|
||||||
secondaryDates.remove(inps.referenceDate)
|
secondaryDates.remove(inps.referenceDate)
|
||||||
return acuisitionDates, inps.referenceDate, secondaryDates
|
return acuisitionDates, inps.referenceDate, secondaryDates
|
||||||
|
|
||||||
|
|
||||||
def slcStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs, splitFlag=False, rubberSheet=False):
|
def slcStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs, splitFlag=False, rubberSheet=False):
|
||||||
# A coregistered stack of SLCs
|
# A coregistered stack of SLCs
|
||||||
i=0
|
i=0
|
||||||
|
|
||||||
|
|
||||||
if inps.bbox:
|
if inps.bbox:
|
||||||
i+=1
|
i+=1
|
||||||
runObj = run()
|
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.crop(acquisitionDates, config_prefix, native=not inps.zerodop, israw=not inps.nofocus)
|
||||||
runObj.finalize()
|
runObj.finalize()
|
||||||
|
|
||||||
|
|
||||||
i+=1
|
i+=1
|
||||||
runObj = run()
|
runObj = run()
|
||||||
runObj.configure(inps, 'run_{:02d}_reference'.format(i))
|
runObj.configure(inps, 'run_{:02d}_reference'.format(i))
|
||||||
|
@ -192,38 +193,38 @@ def slcStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs,
|
||||||
runObj.finalize()
|
runObj.finalize()
|
||||||
|
|
||||||
if rubberSheet:
|
if rubberSheet:
|
||||||
i+=1
|
i+=1
|
||||||
runObj = run()
|
runObj = run()
|
||||||
runObj.configure(inps, 'run_{:02d}_denseOffset'.format(i))
|
runObj.configure(inps, 'run_{:02d}_denseOffset'.format(i))
|
||||||
config_prefix = 'config_denseOffset_'
|
config_prefix = 'config_denseOffset_'
|
||||||
runObj.denseOffsets_Network(pairs, stackReferenceDate, secondaryDates, config_prefix)
|
runObj.denseOffsets_Network(pairs, stackReferenceDate, secondaryDates, config_prefix)
|
||||||
runObj.finalize()
|
runObj.finalize()
|
||||||
|
|
||||||
i+=1
|
i+=1
|
||||||
runObj = run()
|
runObj = run()
|
||||||
runObj.configure(inps, 'run_{:02d}_invertDenseOffsets'.format(i))
|
runObj.configure(inps, 'run_{:02d}_invertDenseOffsets'.format(i))
|
||||||
runObj.invertDenseOffsets()
|
runObj.invertDenseOffsets()
|
||||||
runObj.finalize()
|
runObj.finalize()
|
||||||
|
|
||||||
i+=1
|
i+=1
|
||||||
runObj = run()
|
runObj = run()
|
||||||
runObj.configure(inps, 'run_{:02d}_resampleOffset'.format(i))
|
runObj.configure(inps, 'run_{:02d}_resampleOffset'.format(i))
|
||||||
config_prefix = 'config_resampOffsets_'
|
config_prefix = 'config_resampOffsets_'
|
||||||
runObj.resampleOffset(secondaryDates, config_prefix)
|
runObj.resampleOffset(secondaryDates, config_prefix)
|
||||||
runObj.finalize()
|
runObj.finalize()
|
||||||
|
|
||||||
i+=1
|
i+=1
|
||||||
runObj = run()
|
runObj = run()
|
||||||
runObj.configure(inps, 'run_{:02d}_replaceOffsets'.format(i))
|
runObj.configure(inps, 'run_{:02d}_replaceOffsets'.format(i))
|
||||||
runObj.replaceOffsets(secondaryDates)
|
runObj.replaceOffsets(secondaryDates)
|
||||||
runObj.finalize()
|
runObj.finalize()
|
||||||
|
|
||||||
i+=1
|
i+=1
|
||||||
runObj = run()
|
runObj = run()
|
||||||
runObj.configure(inps, 'run_{:02d}_fineResamp'.format(i))
|
runObj.configure(inps, 'run_{:02d}_fineResamp'.format(i))
|
||||||
config_prefix = 'config_fineResamp_'
|
config_prefix = 'config_fineResamp_'
|
||||||
runObj.secondarys_fine_resampleSlc(stackReferenceDate, secondaryDates, config_prefix, split=splitFlag)
|
runObj.secondarys_fine_resampleSlc(stackReferenceDate, secondaryDates, config_prefix, split=splitFlag)
|
||||||
runObj.finalize()
|
runObj.finalize()
|
||||||
|
|
||||||
# adding the baseline grid generation
|
# adding the baseline grid generation
|
||||||
i+=1
|
i+=1
|
||||||
|
@ -235,11 +236,11 @@ def slcStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs,
|
||||||
|
|
||||||
return i
|
return i
|
||||||
|
|
||||||
|
|
||||||
def interferogramStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs):
|
def interferogramStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs):
|
||||||
# an interferogram stack without ionosphere correction.
|
# an interferogram stack without ionosphere correction.
|
||||||
# coregistration is with geometry + const offset
|
# coregistration is with geometry + const offset
|
||||||
|
|
||||||
|
|
||||||
i = slcStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs, splitFlag=False, rubberSheet=False)
|
i = slcStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs, splitFlag=False, rubberSheet=False)
|
||||||
|
|
||||||
i+=1
|
i+=1
|
||||||
|
@ -249,6 +250,8 @@ def interferogramStack(inps, acquisitionDates, stackReferenceDate, secondaryDate
|
||||||
low_or_high = "/"
|
low_or_high = "/"
|
||||||
runObj.igrams_network(pairs, acquisitionDates, stackReferenceDate, low_or_high, config_prefix)
|
runObj.igrams_network(pairs, acquisitionDates, stackReferenceDate, low_or_high, config_prefix)
|
||||||
runObj.finalize()
|
runObj.finalize()
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
def interferogramIonoStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs):
|
def interferogramIonoStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs):
|
||||||
|
|
||||||
|
@ -297,69 +300,68 @@ def interferogramIonoStack(inps, acquisitionDates, stackReferenceDate, secondary
|
||||||
config_prefix = 'config_iono_'
|
config_prefix = 'config_iono_'
|
||||||
lowBand = '/LowBand/'
|
lowBand = '/LowBand/'
|
||||||
highBand = '/HighBand/'
|
highBand = '/HighBand/'
|
||||||
runObj.dispersive_nonDispersive(pairs, acquisitionDates, stackReferenceDate,
|
runObj.dispersive_nonDispersive(pairs, acquisitionDates, stackReferenceDate, lowBand, highBand, config_prefix)
|
||||||
lowBand, highBand, config_prefix)
|
|
||||||
runObj.finalize()
|
runObj.finalize()
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
def main(iargs=None):
|
def main(iargs=None):
|
||||||
|
|
||||||
inps = cmdLineParse(iargs)
|
inps = cmdLineParse(iargs)
|
||||||
# name of the folder of the coreg SLCs including baselines, SLC, geom_reference subfolders
|
# name of the folder of the coreg SLCs including baselines, SLC, geom_reference subfolders
|
||||||
inps.stack_folder = 'merged'
|
inps.stack_folder = 'merged'
|
||||||
inps.dense_offsets_folder = 'dense_offsets'
|
inps.dense_offsets_folder = 'dense_offsets'
|
||||||
|
|
||||||
|
|
||||||
# check if a sensor is defined and update if needed azimuth looks to give square pixels
|
# check if a sensor is defined and update if needed azimuth looks to give square pixels
|
||||||
ar=1
|
ar=1
|
||||||
if inps.sensor:
|
if inps.sensor:
|
||||||
if inps.sensor.lower() == "alos":
|
if inps.sensor.lower() == "alos":
|
||||||
ar=4
|
ar=4
|
||||||
print("Looks like " + inps.sensor.lower() + ", multi-look AR=" + str(ar))
|
print("Looks like " + inps.sensor.lower() + ", multi-look AR=" + str(ar))
|
||||||
elif inps.sensor.lower() == "envisat" or inps.sensor.lower() == "ers":
|
elif inps.sensor.lower() == "envisat" or inps.sensor.lower() == "ers":
|
||||||
ar=5
|
ar=5
|
||||||
print("Looks like " + inps.sensor.lower() + ", multi-look AR=" + str(ar))
|
print("Looks like " + inps.sensor.lower() + ", multi-look AR=" + str(ar))
|
||||||
else:
|
else:
|
||||||
print("Sensor is not hard-coded (ers, envisat, alos), will keep default alks")
|
print("Sensor is not hard-coded (ers, envisat, alos), will keep default alks")
|
||||||
# sensor is not recognised, report to user and state default
|
# sensor is not recognised, report to user and state default
|
||||||
inps.alks = str(int(inps.alks)*int(ar))
|
inps.alks = str(int(inps.alks)*int(ar))
|
||||||
|
|
||||||
# getting the acquisitions
|
# getting the acquisitions
|
||||||
acquisitionDates, stackReferenceDate, secondaryDates = get_dates(inps)
|
acquisitionDates, stackReferenceDate, secondaryDates = get_dates(inps)
|
||||||
configDir = os.path.join(inps.workDir,'configs')
|
configDir = os.path.join(inps.workDir,'configs')
|
||||||
os.makedirs(configDir, exist_ok=True)
|
os.makedirs(configDir, exist_ok=True)
|
||||||
runDir = os.path.join(inps.workDir,'run_files')
|
runDir = os.path.join(inps.workDir,'run_files')
|
||||||
os.makedirs(runDir, exist_ok=True)
|
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.lower() == 'uavsar_stack': # don't try to calculate baselines for UAVSAR_STACK data
|
||||||
pairs = selectPairs(inps,stackReferenceDate, secondaryDates, acquisitionDates,doBaselines=False)
|
pairs = selectPairs(inps,stackReferenceDate, secondaryDates, acquisitionDates,doBaselines=False)
|
||||||
else:
|
else:
|
||||||
pairs = selectPairs(inps,stackReferenceDate, secondaryDates, acquisitionDates,doBaselines=True)
|
pairs = selectPairs(inps,stackReferenceDate, secondaryDates, acquisitionDates,doBaselines=True)
|
||||||
print ('number of pairs: ', len(pairs))
|
print ('number of pairs: ', len(pairs))
|
||||||
|
|
||||||
###If only a summary is requested quit after this
|
###If only a summary is requested quit after this
|
||||||
if inps.summary:
|
if inps.summary:
|
||||||
return
|
return
|
||||||
|
|
||||||
#if cropping is requested, then change the slc directory:
|
#if cropping is requested, then change the slc directory:
|
||||||
inps.fullFrameSlcDir = inps.slcDir
|
inps.fullFrameSlcDir = inps.slcDir
|
||||||
|
|
||||||
if inps.bbox:
|
if inps.bbox:
|
||||||
inps.slcDir = inps.slcDir + "_crop"
|
inps.slcDir = inps.slcDir + "_crop"
|
||||||
#############################
|
#############################
|
||||||
|
|
||||||
if inps.workflow == 'slc':
|
if inps.workflow == 'slc':
|
||||||
slcStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs, splitFlag=False, rubberSheet=False)
|
slcStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs, splitFlag=False, rubberSheet=False)
|
||||||
|
|
||||||
elif inps.workflow == 'interferogram':
|
elif inps.workflow == 'interferogram':
|
||||||
interferogramStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs)
|
interferogramStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs)
|
||||||
|
|
||||||
elif inps.workflow == 'ionosphere':
|
elif inps.workflow == 'ionosphere':
|
||||||
interferogramIonoStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs)
|
interferogramIonoStack(inps, acquisitionDates, stackReferenceDate, secondaryDates, pairs)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
# Main engine
|
||||||
# Main engine
|
main(sys.argv[1:])
|
||||||
main()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue