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.py
LT1AB
Zhang Yunjun 2021-06-13 21:13:55 -07:00
parent 44deb3991c
commit dea56dac56
2 changed files with 77 additions and 78 deletions

View File

@ -5,17 +5,18 @@
# Heresh Fattahi, updated for stack processing # Heresh Fattahi, updated for stack processing
import numpy as np
import os import os
import isce import glob
import isceobj
import datetime import datetime
import logging import logging
import argparse import argparse
import numpy as np
import isce
import isceobj
from isceobj.Util.ImageUtil import ImageLib as IML from isceobj.Util.ImageUtil import ImageLib as IML
from isceobj.Util.decorators import use_api from isceobj.Util.decorators import use_api
import s1a_isce_utils as ut import s1a_isce_utils as ut
import glob
def createParser(): def createParser():
@ -39,20 +40,19 @@ def createParser():
parser.add_argument('-m', '--method', type=str, dest='method', default='avg', parser.add_argument('-m', '--method', type=str, dest='method', default='avg',
help='Method: top / bot/ avg') help='Method: top / bot/ avg')
parser.add_argument('-a', '--aligned', action='store_true', dest='isaligned', parser.add_argument('-a', '--aligned', action='store_true', dest='isaligned', default=False,
default=False, help='Use reference information instead of coreg for merged grid.') help='Use reference information instead of coreg for merged grid.')
parser.add_argument('-l', '--multilook', action='store_true', dest='multilook', default=False, parser.add_argument('-l', '--multilook', action='store_true', dest='multilook', default=False,
help='Multilook the merged products. True or False') help='Multilook the merged products. True or False')
parser.add_argument('-A', '--azimuth_looks', type=str, dest='numberAzimuthLooks', default=3, parser.add_argument('-A', '--azimuth_looks', type=str, dest='numberAzimuthLooks', default=3, help='azimuth looks')
help = 'azimuth looks')
parser.add_argument('-R', '--range_looks', type=str, dest='numberRangeLooks', default=9, parser.add_argument('-R', '--range_looks', type=str, dest='numberRangeLooks', default=9, help='range looks')
help = 'range looks')
parser.add_argument('-n', '--name_pattern', type=str, dest='namePattern', default='fine*int', 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, 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).') 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): def main(iargs=None):
''' '''
Merge burst products to make it look like stripmap. Merge burst products to make it look like stripmap.
@ -391,7 +388,8 @@ def main(iargs=None):
frames.append(ifg) frames.append(ifg)
referenceFrames.append(reference) referenceFrames.append(reference)
print('bursts: ', minBurst, maxBurst) 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) mergedir = os.path.dirname(inps.outfile)
os.makedirs(mergedir, exist_ok=True) os.makedirs(mergedir, exist_ok=True)
@ -399,10 +397,7 @@ def main(iargs=None):
suffix = '.full' suffix = '.full'
if (inps.numberRangeLooks == 1) and (inps.numberAzimuthLooks==1): if (inps.numberRangeLooks == 1) and (inps.numberAzimuthLooks==1):
suffix='' suffix=''
####Virtual flag is ignored for multi-swath data ####Virtual flag is ignored for multi-swath data
if (not virtual): if (not virtual):
print('User requested for multi-swath stitching.') print('User requested for multi-swath stitching.')
print('Virtual files are the only option for this.') print('Virtual files are the only option for this.')
@ -417,10 +412,12 @@ def main(iargs=None):
print(inps.multilook) print(inps.multilook)
if inps.multilook: if inps.multilook:
multilook(inps.outfile+suffix, outname = inps.outfile, multilook(inps.outfile+suffix,
alks = inps.numberAzimuthLooks, rlks=inps.numberRangeLooks, outname=inps.outfile,
multilook_tool=inps.multilookTool, no_data=inps.noData) alks=inps.numberAzimuthLooks,
rlks=inps.numberRangeLooks,
multilook_tool=inps.multilookTool,
no_data=inps.noData)
else: else:
print('Skipping multi-looking ....') print('Skipping multi-looking ....')
@ -428,5 +425,4 @@ if __name__ == '__main__' :
''' '''
Merge products burst-by-burst. Merge products burst-by-burst.
''' '''
main() main()

View File

@ -32,10 +32,10 @@ def saveProduct( obj, xmlname):
''' '''
Save the product to an XML file using Product Manager. Save the product to an XML file using Product Manager.
''' '''
# import shelve import shelve
# import os import os
# with shelve.open(os.path.dirname(xmlname) + '/'+ os.path.basename(xmlname) +'.data') as db: with shelve.open(os.path.dirname(xmlname) + '/'+ os.path.basename(xmlname) +'.data') as db:
# db['data'] = obj db['data'] = obj
from iscesys.Component.ProductManager import ProductManager as PM from iscesys.Component.ProductManager import ProductManager as PM
@ -46,6 +46,7 @@ def saveProduct( obj, xmlname):
return None return None
def getRelativeShifts(mFrame, sFrame, minBurst, maxBurst, secondaryBurstStart): def getRelativeShifts(mFrame, sFrame, minBurst, maxBurst, secondaryBurstStart):
''' '''
Estimate the relative shifts between the start of the bursts. 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 return reference
def adjustCommonValidRegion(reference,secondary): def adjustCommonValidRegion(reference,secondary):
# valid lines between reference and secondary # valid lines between reference and secondary
@ -264,6 +266,7 @@ def asBaseClass(inobj):
else: else:
raise Exception('Cannot be converted to TOPSSwathSLCProduct') raise Exception('Cannot be converted to TOPSSwathSLCProduct')
def getSwathList(indir): def getSwathList(indir):
swathList = [] swathList = []