skip filtering if --filter_strength <= 0

+ FilterAndCoherence: skip filtering if input filter strength <= 0 and use original phase for coherence estimation

+ Stack: do not add filt_ prefix to output file if input filter strength <= 0
LT1AB
Zhang Yunjun 2020-04-28 16:21:26 -07:00 committed by piyushrpt
parent d494ae3924
commit 6a78c4e6d6
3 changed files with 19 additions and 8 deletions

View File

@ -28,7 +28,6 @@
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import logging
import isce
import isceobj
@ -36,6 +35,7 @@ import argparse
import os
logger = logging.getLogger('isce.tops.runFilter')
def runFilter(infile, outfile, filterStrength):
from mroipac.filter.Filter import Filter
logger.info("Applying power-spectral filter")
@ -61,10 +61,11 @@ def runFilter(infile, outfile, filterStrength):
intImage.finalizeImage()
filtImage.finalizeImage()
def estCoherence(outfile, corfile):
from mroipac.icu.Icu import Icu
logger.info("Estimating spatial coherence based phase sigma")
#Create phase sigma correlation file here
filtImage = isceobj.createIntImage()
@ -110,6 +111,7 @@ def createParser():
return parser
def cmdLineParse(iargs=None):
parser = createParser()
return parser.parse_args(args=iargs)
@ -121,7 +123,11 @@ def main(iargs=None):
if inps.filtfile is None:
inps.filtfile = 'filt_' + inps.infile
runFilter(inps.infile, inps.filtfile, inps.filterstrength)
if inps.filterstrength <= 0.:
inps.filtfile = inps.infile
logger.info('input filter strength "{}" <= 0, skip filtering.'.format(inps.filterstrength))
else:
runFilter(inps.infile, inps.filtfile, inps.filterstrength)
estCoherence(inps.filtfile, inps.cohfile)

View File

@ -614,10 +614,15 @@ class run(object):
pair[0] + '_' + pair[1])
configObj.generateIgram('[Function-1]')
configObj.igram = configObj.outDir+'.int'
configObj.filtIgram = os.path.dirname(configObj.outDir) + '/filt_' + pair[0] + '_' + pair[1] + '.int'
configObj.coherence = os.path.dirname(configObj.outDir) + '/filt_' + pair[0] + '_' + pair[1] + '.cor'
#configObj.filtStrength = filtStrength
if float(configObj.filtStrength) > 0.:
configObj.filtIgram = os.path.dirname(configObj.outDir) + '/filt_' + pair[0] + '_' + pair[1] + '.int'
configObj.coherence = os.path.dirname(configObj.outDir) + '/filt_' + pair[0] + '_' + pair[1] + '.cor'
else:
# do not add prefix filt_ to output file if no filtering is applied.
configObj.filtIgram = os.path.dirname(configObj.outDir) + '/' + pair[0] + '_' + pair[1] + '.int'
configObj.coherence = os.path.dirname(configObj.outDir) + '/' + pair[0] + '_' + pair[1] + '.cor'
configObj.filterCoherence('[Function-2]')
# skip phase unwrapping if input method == no

View File

@ -58,11 +58,11 @@ def createParser():
help='SAR sensor used to define square multi-look pixels')
parser.add_argument('-u', '--unw_method', dest='unwMethod', type=str, default='snaphu',
help='unwrapping method (icu, snaphu, or snaphu2stage)')
help='unwrapping method (icu, snaphu, or snaphu2stage), no to skip phase unwrapping.')
parser.add_argument('-f','--filter_strength', dest='filtStrength', type=str, default=filtStrength,
help='strength of Goldstein filter applied to the wrapped phase before spatial coherence estimation.'
' Default: {}'.format(filtStrength))
' Default: {}. 0 to skip filtering.'.format(filtStrength))
iono = parser.add_argument_group('Ionosphere', 'Configurationas for ionospheric correction')
iono.add_argument('-L', '--low_band_frequency', dest='fL', type=str, default=None,