Example #1
0
def getDataOpts():
	'Get SAC Data and Options'
	opts, ifiles = getOptions()
	pppara = PPConfig()
	gsac = loadData(ifiles, opts, pppara)
	opts.pppara = pppara
	return gsac, opts
Example #2
0
def main():
    opts, ifiles = getOptions()
    ccpara = CCConfig()
    gsac = loadData(ifiles, opts, ccpara)
    opts.ccpara = ccpara
    ccpara.twcorr = opts.twcorr
    ccpara.cchdrs = [opts.ipick, opts.wpick]
    # check data coverage, initialize quality factors
    checkCoverage(gsac, opts)
    initQual(gsac.saclist, opts.ccpara.hdrsel, opts.ccpara.qheaders)

    if opts.auto_on:
        autoiccs(gsac, opts)
    elif opts.auto_on_all:
        print('Selecting all seismograms..')
        hdrsel = opts.ccpara.hdrsel
        for sacdh in gsac.saclist:
            sacdh.selected = True
            sacdh.sethdr(hdrsel, 'True    ')
        autoiccs(gsac, opts)
    else:
        stkdh, stkdata, quas = ccWeightStack(gsac.saclist, opts)
        gsac.stkdh = stkdh
        saveData(gsac, opts)
    if opts.plotiter:
        plotiter(stkdata)
Example #3
0
def main():
	opts, ifiles = getOptions()
	ccpara = CCConfig()
	gsac = loadData(ifiles, opts, ccpara)
	opts.ccpara = ccpara
	ccpara.twcorr = opts.twcorr
	ccpara.cchdrs = [opts.ipick, opts.wpick]
	# check data coverage, initialize quality factors
	checkCoverage(gsac, opts) 
	initQual(gsac.saclist, opts.ccpara.hdrsel, opts.ccpara.qheaders)

	if opts.auto_on:
		autoiccs(gsac, opts)
	elif opts.auto_on_all:
		print ('Selecting all seismograms..')
		hdrsel = opts.ccpara.hdrsel
		for sacdh in gsac.saclist:
			sacdh.selected = True
			sacdh.sethdr(hdrsel, 'True    ')
		autoiccs(gsac, opts)
	else:
		stkdh, stkdata, quas = ccWeightStack(gsac.saclist, opts)
		gsac.stkdh = stkdh
		saveData(gsac, opts)
	if opts.plotiter:
		plotiter(stkdata)
Example #4
0
def getDataOpts():
    'Get SAC Data and Options'
    opts, ifiles = getOptions()
    pppara = PPConfig()
    gsac = loadData(ifiles, opts, pppara)
    opts.pppara = pppara
    return gsac, opts
Example #5
0
def getDataOpts():
    'Get SAC Data and Options'
    opts, ifiles = getOptions()
    pppara = PPConfig()
    gsac = loadData(ifiles, opts, pppara)
    opts.pppara = pppara
    opts.qheaders = pppara.qheaders
    opts.qfactors = pppara.qfactors
    opts.qweights = pppara.qweights
    opts.hdrsel = pppara.hdrsel
    opts.pick_on = True
    initQual(gsac.saclist, opts.hdrsel, opts.qheaders)
    sortSeis(gsac, opts)
    return gsac, opts
Example #6
0
def getDataOpts():
	'Get SAC Data and Options'
	opts, ifiles = getOptions()
	pppara = PPConfig()
	gsac = loadData(ifiles, opts, pppara)
	opts.pppara = pppara
	opts.qheaders = pppara.qheaders
	opts.qfactors = pppara.qfactors
	opts.qweights = pppara.qweights
	opts.hdrsel = pppara.hdrsel
	opts.pick_on = True
	initQual(gsac.saclist, opts.hdrsel, opts.qheaders)
	sortSeis(gsac, opts)
	return gsac, opts
Example #7
0
def getDataOpts():
	'Get SAC Data and Options'
	opts, ifiles = getOptions()
	pppara = PPConfig()
	qcpara = QCConfig()
	ccpara = CCConfig()
	mcpara = MCConfig()
	gsac = loadData(ifiles, opts, pppara)
	mcpara.delta = opts.delta
	opts.qheaders = qcpara.qheaders
	opts.qweights = qcpara.qweights
	opts.qfactors = qcpara.qfactors
	opts.hdrsel = qcpara.hdrsel
	opts.fstack = ccpara.fstack
	ccpara.qqhdrs = qcpara.qheaders
	ccpara.twcorr = opts.twcorr
	# find phase:
	if opts.phase is None:
		phase = findPhase(ifiles[0])
		print ('Found phase to be: ' + phase + '\n')
	else:
		phase = opts.phase
	mcpara.phase = phase
	opts.qcpara = qcpara
	opts.ccpara = ccpara
	opts.mcpara = mcpara
	opts.pppara = pppara
	# more options:
	opts.upylim_on = False
	opts.twin_on = True
	opts.sort_on = True
	opts.pick_on = True
	opts.zero_on = False
	opts.nlab_on = True
	opts.ynormtwin_on = True
	#checkCoverage(gsac, opts)
	initQual(gsac.saclist, opts.hdrsel, opts.qheaders)
	return gsac, opts
Example #8
0
def main():
    opts, ifiles = getOptions()
    mcpara = MCConfig()
    gsac = loadData(ifiles, opts, mcpara)

    if opts.phase is None:
        phase = findPhase(ifiles[0])
        print('Found phase to be: ' + phase + '\n')
        mcpara.phase = phase

    opts.fstack = mcpara.fstack
    if opts.filemode == 'sac' and os.path.isfile(opts.fstack):
        print('Read array stack file: ' + opts.fstack)
        gsac.stkdh = SacDataHdrs(opts.fstack, opts.delta)

    getParams(gsac, mcpara, opts)
    if opts.allseis_on:
        solution = mccc(gsac, mcpara)
        gsac.selist, gsac.delist = gsac.saclist, []
    else:
        initQual(gsac.saclist, mcpara.hdrsel, [])
        gsac.selist, gsac.delist = seleSeis(gsac.saclist)
        solution = mccc(gsac, mcpara)
    saveData(gsac, opts)
Example #9
0
def main():
	opts, ifiles = getOptions()
	mcpara = MCConfig()
	gsac = loadData(ifiles, opts, mcpara)

	if opts.phase is None:
		phase = findPhase(ifiles[0])
		print ('Found phase to be: ' + phase + '\n')
		mcpara.phase = phase

	opts.fstack = mcpara.fstack
	if opts.filemode == 'sac' and os.path.isfile(opts.fstack):
		print ('Read array stack file: ' + opts.fstack )
		gsac.stkdh = SacDataHdrs(opts.fstack, opts.delta)

	getParams(gsac, mcpara, opts)
	if opts.allseis_on:
		solution = mccc(gsac, mcpara)
		gsac.selist, gsac.delist = gsac.saclist, []
	else:
		initQual(gsac.saclist, mcpara.hdrsel, [])
		gsac.selist, gsac.delist = seleSeis(gsac.saclist)
		solution = mccc(gsac, mcpara)
	saveData(gsac, opts)
Example #10
0
		sortlist.append(sorlist)
	return sortlist


def getOptions():
	""" Parse arguments and options. """
	usage = "Usage: %prog [options] <sacfile(s) or a picklefile>"
	parser = OptionParser(usage=usage)
	opts, files = parser.parse_args(sys.argv[1:])
	return opts, files


# for testing
if __name__ == '__main__':
	from ttconfig import QCConfig
	from sacpickle import loadData
	from optparse import OptionParser
	import sys

	opts, ifiles = getOptions()
	qcpara = QCConfig()
	qheaders = qcpara.qheaders
	qfactors = qcpara.qfactors
	qweights = qcpara.qweights
	hdrsel = qcpara.hdrsel
	opts.srate = -1
	gsac = loadData(ifiles, opts, qcpara)
	initQual(gsac.saclist, hdrsel, qheaders)
	sorselist, sordelist = sortSeisQual(gsac.saclist, qheaders, qweights, qfactors)

Example #11
0
            sorlist = []
        sortlist.append(sorlist)
    return sortlist


def getOptions():
    """ Parse arguments and options. """
    usage = "Usage: %prog [options] <sacfile(s) or a picklefile>"
    parser = OptionParser(usage=usage)
    opts, files = parser.parse_args(sys.argv[1:])
    return opts, files


# for testing
if __name__ == '__main__':
    from ttconfig import QCConfig
    from sacpickle import loadData
    from optparse import OptionParser

    opts, ifiles = getOptions()
    qcpara = QCConfig()
    qheaders = qcpara.qheaders
    qfactors = qcpara.qfactors
    qweights = qcpara.qweights
    hdrsel = qcpara.hdrsel
    opts.srate = -1
    gsac = loadData(ifiles, opts, qcpara)
    initQual(gsac.saclist, hdrsel, qheaders)
    sorselist, sordelist = sortSeisQual(gsac.saclist, qheaders, qweights,
                                        qfactors)
Example #12
0
def getDataOpts():
    'Get SAC Data and Options'
    opts, ifiles = getOptions()
    pppara = PPConfig()
    qcpara = QCConfig()
    ccpara = CCConfig()
    mcpara = MCConfig()

    gsac = loadData(ifiles, opts, pppara)

    # set defaults
    filterParameters = {}
    filterParameters['apply'] = False
    filterParameters['advance'] = False
    filterParameters['band'] = 'bandpass'
    filterParameters['lowFreq'] = 0.05
    filterParameters['highFreq'] = 0.25
    filterParameters['order'] = 2
    filterParameters['reversepass'] = False
    opts.filterParameters = filterParameters

    # override defaults if already set in SAC files
    firstSacdh = gsac.saclist[0]
    if hasattr(firstSacdh, 'user0'):
        filterParameters['lowFreq'] = firstSacdh.user0
    if hasattr(firstSacdh, 'user1'):
        filterParameters['highFreq'] = firstSacdh.user1
    if hasattr(firstSacdh, 'kuser0'):
        filterParameters['band'] = firstSacdh.kuser0
    if hasattr(firstSacdh, 'kuser1'):
        filterParameters['order'] = int(firstSacdh.kuser1)

    mcpara.delta = opts.delta
    opts.qheaders = qcpara.qheaders
    opts.qweights = qcpara.qweights
    opts.qfactors = qcpara.qfactors
    opts.hdrsel = qcpara.hdrsel
    opts.fstack = ccpara.fstack
    ccpara.qqhdrs = qcpara.qheaders
    ccpara.twcorr = opts.twcorr
    # find phase:
    if opts.phase is None:
        phase = findPhase(ifiles[0])
        print('Found phase to be: ' + phase + '\n')
    else:
        phase = opts.phase
    mcpara.phase = phase
    opts.qcpara = qcpara
    opts.ccpara = ccpara
    opts.mcpara = mcpara
    opts.pppara = pppara
    # more options:
    opts.upylim_on = False
    opts.twin_on = True
    opts.sort_on = True
    opts.pick_on = True
    opts.zero_on = False
    opts.nlab_on = True
    opts.ynormtwin_on = True
    #checkCoverage(gsac, opts)
    initQual(gsac.saclist, opts.hdrsel, opts.qheaders)
    return gsac, opts
Example #13
0
def getDataOpts():
	'Get SAC Data and Options'
	opts, ifiles = getOptions()
	pppara = PPConfig()
	qcpara = QCConfig()
	ccpara = CCConfig()
	mcpara = MCConfig()

	gsac = loadData(ifiles, opts, pppara)

	# set defaults
	filterParameters = {}
	filterParameters['apply'] = False
	filterParameters['advance'] = False
	filterParameters['band'] = 'bandpass'
	filterParameters['lowFreq'] = 0.05
	filterParameters['highFreq'] = 0.25
	filterParameters['order'] = 2
	filterParameters['reversepass'] = False
	opts.filterParameters = filterParameters

	# override defaults if already set in SAC files
	firstSacdh = gsac.saclist[0]
	if hasattr(firstSacdh, 'user0'):
		filterParameters['lowFreq'] = firstSacdh.user0
	if hasattr(firstSacdh, 'user1'):
		filterParameters['highFreq'] = firstSacdh.user1
	if hasattr(firstSacdh, 'kuser0'):
		filterParameters['band'] = firstSacdh.kuser0
	if hasattr(firstSacdh, 'kuser1'):
		filterParameters['order'] = int(firstSacdh.kuser1)

	mcpara.delta = opts.delta
	opts.qheaders = qcpara.qheaders
	opts.qweights = qcpara.qweights
	opts.qfactors = qcpara.qfactors
	opts.hdrsel = qcpara.hdrsel
	opts.fstack = ccpara.fstack
	ccpara.qqhdrs = qcpara.qheaders
	ccpara.twcorr = opts.twcorr
	# find phase:
	if opts.phase is None:
		phase = findPhase(ifiles[0])
		print ('Found phase to be: ' + phase + '\n')
	else:
		phase = opts.phase
	mcpara.phase = phase
	opts.qcpara = qcpara
	opts.ccpara = ccpara
	opts.mcpara = mcpara
	opts.pppara = pppara
	# more options:
	opts.upylim_on = False
	opts.twin_on = True
	opts.sort_on = True
	opts.pick_on = True
	opts.zero_on = False
	opts.nlab_on = True
	opts.ynormtwin_on = True
	#checkCoverage(gsac, opts)
	initQual(gsac.saclist, opts.hdrsel, opts.qheaders)
	return gsac, opts