topsStack: mergeBursts & s1a_isce_utils: indentation adjustment
Adjust indentations in the following scripts following pep8 style for improved readibility: + topsStack/mergegBursts.py + topsStack/s1a_isce_utils.pyLT1AB
parent
44deb3991c
commit
dea56dac56
|
@ -5,17 +5,18 @@
|
|||
# Heresh Fattahi, updated for stack processing
|
||||
|
||||
|
||||
import numpy as np
|
||||
import os
|
||||
import isce
|
||||
import isceobj
|
||||
import glob
|
||||
import datetime
|
||||
import logging
|
||||
import argparse
|
||||
import numpy as np
|
||||
|
||||
import isce
|
||||
import isceobj
|
||||
from isceobj.Util.ImageUtil import ImageLib as IML
|
||||
from isceobj.Util.decorators import use_api
|
||||
import s1a_isce_utils as ut
|
||||
import glob
|
||||
|
||||
|
||||
def createParser():
|
||||
|
@ -39,20 +40,19 @@ def createParser():
|
|||
parser.add_argument('-m', '--method', type=str, dest='method', default='avg',
|
||||
help='Method: top / bot/ avg')
|
||||
|
||||
parser.add_argument('-a', '--aligned', action='store_true', dest='isaligned',
|
||||
default=False, help='Use reference information instead of coreg for merged grid.')
|
||||
parser.add_argument('-a', '--aligned', action='store_true', dest='isaligned', default=False,
|
||||
help='Use reference information instead of coreg for merged grid.')
|
||||
|
||||
parser.add_argument('-l', '--multilook', action='store_true', dest='multilook', default=False,
|
||||
help='Multilook the merged products. True or False')
|
||||
|
||||
parser.add_argument('-A', '--azimuth_looks', type=str, dest='numberAzimuthLooks', default=3,
|
||||
help = 'azimuth looks')
|
||||
parser.add_argument('-A', '--azimuth_looks', type=str, dest='numberAzimuthLooks', default=3, help='azimuth looks')
|
||||
|
||||
parser.add_argument('-R', '--range_looks', type=str, dest='numberRangeLooks', default=9,
|
||||
help = 'range looks')
|
||||
parser.add_argument('-R', '--range_looks', type=str, dest='numberRangeLooks', default=9, help='range looks')
|
||||
|
||||
parser.add_argument('-n', '--name_pattern', type=str, dest='namePattern', default='fine*int',
|
||||
help = 'a name pattern of burst products that will be merged. default: fine. it can be lat, lon, los, burst, hgt, shadowMask, incLocal')
|
||||
help='a name pattern of burst products that will be merged. '
|
||||
'default: fine. it can be lat, lon, los, burst, hgt, shadowMask, incLocal')
|
||||
|
||||
parser.add_argument('-v', '--valid_only', action='store_true', dest='validOnly', default=False,
|
||||
help='True for SLC, int and coherence. False for geometry files (lat, lon, los, hgt, shadowMask, incLocal).')
|
||||
|
@ -339,9 +339,6 @@ def multilook(infile, outname=None, alks=5, rlks=15, multilook_tool="isce", no_d
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
#def runMergeBursts(self):
|
||||
def main(iargs=None):
|
||||
'''
|
||||
Merge burst products to make it look like stripmap.
|
||||
|
@ -391,7 +388,8 @@ def main(iargs=None):
|
|||
frames.append(ifg)
|
||||
referenceFrames.append(reference)
|
||||
print('bursts: ', minBurst, maxBurst)
|
||||
fileList.append([os.path.join(inps.dirname, 'IW{0}'.format(swath), namePattern[0] + '_%02d.%s'%(x,namePattern[1])) for x in range(minBurst, maxBurst+1)])
|
||||
fileList.append([os.path.join(inps.dirname, 'IW{0}'.format(swath), namePattern[0] + '_%02d.%s'%(x,namePattern[1]))
|
||||
for x in range(minBurst, maxBurst+1)])
|
||||
|
||||
mergedir = os.path.dirname(inps.outfile)
|
||||
os.makedirs(mergedir, exist_ok=True)
|
||||
|
@ -399,10 +397,7 @@ def main(iargs=None):
|
|||
suffix = '.full'
|
||||
if (inps.numberRangeLooks == 1) and (inps.numberAzimuthLooks==1):
|
||||
suffix=''
|
||||
|
||||
|
||||
####Virtual flag is ignored for multi-swath data
|
||||
|
||||
if (not virtual):
|
||||
print('User requested for multi-swath stitching.')
|
||||
print('Virtual files are the only option for this.')
|
||||
|
@ -417,10 +412,12 @@ def main(iargs=None):
|
|||
|
||||
print(inps.multilook)
|
||||
if inps.multilook:
|
||||
multilook(inps.outfile+suffix, outname = inps.outfile,
|
||||
alks = inps.numberAzimuthLooks, rlks=inps.numberRangeLooks,
|
||||
multilook_tool=inps.multilookTool, no_data=inps.noData)
|
||||
|
||||
multilook(inps.outfile+suffix,
|
||||
outname=inps.outfile,
|
||||
alks=inps.numberAzimuthLooks,
|
||||
rlks=inps.numberRangeLooks,
|
||||
multilook_tool=inps.multilookTool,
|
||||
no_data=inps.noData)
|
||||
else:
|
||||
print('Skipping multi-looking ....')
|
||||
|
||||
|
@ -428,5 +425,4 @@ if __name__ == '__main__' :
|
|||
'''
|
||||
Merge products burst-by-burst.
|
||||
'''
|
||||
|
||||
main()
|
||||
|
|
|
@ -32,10 +32,10 @@ def saveProduct( obj, xmlname):
|
|||
'''
|
||||
Save the product to an XML file using Product Manager.
|
||||
'''
|
||||
# import shelve
|
||||
# import os
|
||||
# with shelve.open(os.path.dirname(xmlname) + '/'+ os.path.basename(xmlname) +'.data') as db:
|
||||
# db['data'] = obj
|
||||
import shelve
|
||||
import os
|
||||
with shelve.open(os.path.dirname(xmlname) + '/'+ os.path.basename(xmlname) +'.data') as db:
|
||||
db['data'] = obj
|
||||
|
||||
from iscesys.Component.ProductManager import ProductManager as PM
|
||||
|
||||
|
@ -46,6 +46,7 @@ def saveProduct( obj, xmlname):
|
|||
|
||||
return None
|
||||
|
||||
|
||||
def getRelativeShifts(mFrame, sFrame, minBurst, maxBurst, secondaryBurstStart):
|
||||
'''
|
||||
Estimate the relative shifts between the start of the bursts.
|
||||
|
@ -177,6 +178,7 @@ def adjustValidSampleLine_V2(reference, secondary, minAz=0, maxAz=0, minRng=0, m
|
|||
|
||||
return reference
|
||||
|
||||
|
||||
def adjustCommonValidRegion(reference,secondary):
|
||||
# valid lines between reference and secondary
|
||||
|
||||
|
@ -264,6 +266,7 @@ def asBaseClass(inobj):
|
|||
else:
|
||||
raise Exception('Cannot be converted to TOPSSwathSLCProduct')
|
||||
|
||||
|
||||
def getSwathList(indir):
|
||||
|
||||
swathList = []
|
||||
|
|
Loading…
Reference in New Issue