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 <= 0LT1AB
parent
d494ae3924
commit
6a78c4e6d6
|
@ -28,7 +28,6 @@
|
||||||
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import isce
|
import isce
|
||||||
import isceobj
|
import isceobj
|
||||||
|
@ -36,6 +35,7 @@ import argparse
|
||||||
import os
|
import os
|
||||||
logger = logging.getLogger('isce.tops.runFilter')
|
logger = logging.getLogger('isce.tops.runFilter')
|
||||||
|
|
||||||
|
|
||||||
def runFilter(infile, outfile, filterStrength):
|
def runFilter(infile, outfile, filterStrength):
|
||||||
from mroipac.filter.Filter import Filter
|
from mroipac.filter.Filter import Filter
|
||||||
logger.info("Applying power-spectral filter")
|
logger.info("Applying power-spectral filter")
|
||||||
|
@ -61,10 +61,11 @@ def runFilter(infile, outfile, filterStrength):
|
||||||
|
|
||||||
intImage.finalizeImage()
|
intImage.finalizeImage()
|
||||||
filtImage.finalizeImage()
|
filtImage.finalizeImage()
|
||||||
|
|
||||||
|
|
||||||
def estCoherence(outfile, corfile):
|
def estCoherence(outfile, corfile):
|
||||||
from mroipac.icu.Icu import Icu
|
from mroipac.icu.Icu import Icu
|
||||||
|
logger.info("Estimating spatial coherence based phase sigma")
|
||||||
|
|
||||||
#Create phase sigma correlation file here
|
#Create phase sigma correlation file here
|
||||||
filtImage = isceobj.createIntImage()
|
filtImage = isceobj.createIntImage()
|
||||||
|
@ -110,6 +111,7 @@ def createParser():
|
||||||
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
def cmdLineParse(iargs=None):
|
def cmdLineParse(iargs=None):
|
||||||
parser = createParser()
|
parser = createParser()
|
||||||
return parser.parse_args(args=iargs)
|
return parser.parse_args(args=iargs)
|
||||||
|
@ -121,7 +123,11 @@ def main(iargs=None):
|
||||||
if inps.filtfile is None:
|
if inps.filtfile is None:
|
||||||
inps.filtfile = 'filt_' + inps.infile
|
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)
|
estCoherence(inps.filtfile, inps.cohfile)
|
||||||
|
|
||||||
|
|
|
@ -614,10 +614,15 @@ class run(object):
|
||||||
pair[0] + '_' + pair[1])
|
pair[0] + '_' + pair[1])
|
||||||
|
|
||||||
configObj.generateIgram('[Function-1]')
|
configObj.generateIgram('[Function-1]')
|
||||||
|
|
||||||
configObj.igram = configObj.outDir+'.int'
|
configObj.igram = configObj.outDir+'.int'
|
||||||
configObj.filtIgram = os.path.dirname(configObj.outDir) + '/filt_' + pair[0] + '_' + pair[1] + '.int'
|
if float(configObj.filtStrength) > 0.:
|
||||||
configObj.coherence = os.path.dirname(configObj.outDir) + '/filt_' + pair[0] + '_' + pair[1] + '.cor'
|
configObj.filtIgram = os.path.dirname(configObj.outDir) + '/filt_' + pair[0] + '_' + pair[1] + '.int'
|
||||||
#configObj.filtStrength = filtStrength
|
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]')
|
configObj.filterCoherence('[Function-2]')
|
||||||
|
|
||||||
# skip phase unwrapping if input method == no
|
# skip phase unwrapping if input method == no
|
||||||
|
|
|
@ -58,11 +58,11 @@ def createParser():
|
||||||
help='SAR sensor used to define square multi-look pixels')
|
help='SAR sensor used to define square multi-look pixels')
|
||||||
|
|
||||||
parser.add_argument('-u', '--unw_method', dest='unwMethod', type=str, default='snaphu',
|
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,
|
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.'
|
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 = parser.add_argument_group('Ionosphere', 'Configurationas for ionospheric correction')
|
||||||
iono.add_argument('-L', '--low_band_frequency', dest='fL', type=str, default=None,
|
iono.add_argument('-L', '--low_band_frequency', dest='fL', type=str, default=None,
|
||||||
|
|
Loading…
Reference in New Issue