def sortSeis(gsac, opts): 'Sort seismograms by file indices, quality factors, or a given header' sortby = opts.sortby # determine increase/decrease order if sortby[-1] == '-': sortincrease = False sortby = sortby[:-1] else: sortincrease = True opts.labelqual = False # sort if sortby == 'i': # by file indices gsac.selist, gsac.delist = seleSeis(gsac.saclist) elif sortby.isdigit() or sortby in opts.qheaders + [ 'all', ]: # by quality factors opts.labelqual = True if sortby == '1' or sortby == 'ccc': opts.qweights = [1, 0, 0] elif sortby == '2' or sortby == 'snr': opts.qweights = [0, 1, 0] elif sortby == '3' or sortby == 'coh': opts.qweights = [0, 0, 1] gsac.selist, gsac.delist = sortSeisQual(gsac.saclist, opts.qheaders, opts.qweights, opts.qfactors, sortincrease) else: # by a given header gsac.selist, gsac.delist = sortSeisHeader(gsac.saclist, sortby, sortincrease) return
def sortSeis(gsac, opts): 'Sort seismograms by file indices, quality factors, or a given header' sortby = opts.sortby # determine increase/decrease order if sortby[-1] == '-': sortincrease = False sortby = sortby[:-1] else: sortincrease = True opts.labelqual = False # sort if sortby == 'i': # by file indices gsac.selist, gsac.delist = seleSeis(gsac.saclist) elif sortby.isdigit() or sortby in opts.qheaders + ['all',]: # by quality factors opts.labelqual = True if sortby == '1' or sortby == 'ccc': opts.qweights = [1, 0, 0] elif sortby == '2' or sortby == 'snr': opts.qweights = [0, 1, 0] elif sortby == '3' or sortby == 'coh': opts.qweights = [0, 0, 1] gsac.selist, gsac.delist = sortSeisQual(gsac.saclist, opts.qheaders, opts.qweights, opts.qfactors, sortincrease) else: # by a given header gsac.selist, gsac.delist = sortSeisHeader(gsac.saclist, sortby, sortincrease) return
def sortSeis(gsac, opts): 'Sort seismograms by file indices, quality factors, time difference, or a given header.' sortby = opts.sortby # determine increase/decrease order if sortby[-1] == '-': sortincrease = False sortby = sortby[:-1] else: sortincrease = True opts.labelqual = True # sort if sortby == 'i': # by file indices gsac.selist, gsac.delist = seleSeis(gsac.saclist) elif sortby == 't': # by time difference ipick = opts.qcpara.ichdrs[0] wpick = 't'+str(opts.reltime) if ipick == wpick: print ('Same time pick: {0:s} and {1:s}. Exit'.format(ipick, wpick)) sys.exit() gsac.selist, gsac.delist = sortSeisHeaderDiff(gsac.saclist, ipick, wpick, sortincrease) elif sortby.isdigit() or sortby in opts.qheaders + ['all',]: # by quality factors if sortby == '1' or sortby == 'ccc': opts.qweights = [1, 0, 0] elif sortby == '2' or sortby == 'snr': opts.qweights = [0, 1, 0] elif sortby == '3' or sortby == 'coh': opts.qweights = [0, 0, 1] gsac.selist, gsac.delist = sortSeisQual(gsac.saclist, opts.qheaders, opts.qweights, opts.qfactors, sortincrease) else: # by a given header gsac.selist, gsac.delist = sortSeisHeader(gsac.saclist, sortby, sortincrease) return
def sortSeis(self): sortincrease = True if self.opts.sortby == 'i': self.sacgroup.selist, self.sacgroup.delist = seleSeis( self.sacgroup.saclist) elif self.opts.sortby == 't': ipick = self.opts.qcpara.ichdrs[0] wpick = 't' + str(self.opts.reltime) if ipick == wpick: print('Same time pick: {0:s} and {1:s}. Exit'.format( ipick, wpick)) sys.exit() self.sacgroup.selist, self.sacgroup.delist = sortSeisHeaderDiff( self.sacgroup.saclist, ipick, wpick, sortincrease) elif self.opts.sortby.isdigit( ) or self.opts.sortby in self.opts.qheaders + [ 'all', ]: if self.opts.sortby == '1' or self.opts.sortby == 'ccc': self.opts.qweights = [1, 0, 0] elif self.opts.sortby == '2' or self.opts.sortby == 'snr': self.opts.qweights = [0, 1, 0] elif self.opts.sortby == '3' or self.opts.sortby == 'coh': self.opts.qweights = [0, 0, 1] self.sacgroup.selist, self.sacgroup.delist = sortSeisQual( self.sacgroup.saclist, self.opts.qheaders, self.opts.qweights, self.opts.qfactors, sortincrease) else: self.sacgroup.selist, self.sacgroup.delist = sortSeisHeader( self.sacgroup.saclist, self.opts.sortby, sortincrease)
def sortSeis(gsac, opts): "Sort seismograms by file indices, quality factors, time difference, or a given header." sortby = opts.sortby # determine increase/decrease order if sortby[-1] == "-": sortincrease = False sortby = sortby[:-1] else: sortincrease = True opts.labelqual = True # sort if sortby == "i": # by file indices gsac.selist, gsac.delist = seleSeis(gsac.saclist) elif sortby == "t": # by time difference ipick = opts.qcpara.ichdrs[0] wpick = "t" + str(opts.reltime) if ipick == wpick: print ("Same time pick: {0:s} and {1:s}. Exit".format(ipick, wpick)) sys.exit() gsac.selist, gsac.delist = sortSeisHeaderDiff(gsac.saclist, ipick, wpick, sortincrease) elif sortby.isdigit() or sortby in opts.qheaders + ["all"]: # by quality factors if sortby == "1" or sortby == "ccc": opts.qweights = [1, 0, 0] elif sortby == "2" or sortby == "snr": opts.qweights = [0, 1, 0] elif sortby == "3" or sortby == "coh": opts.qweights = [0, 0, 1] gsac.selist, gsac.delist = sortSeisQual(gsac.saclist, opts.qheaders, opts.qweights, opts.qfactors, sortincrease) else: # by a given header gsac.selist, gsac.delist = sortSeisHeader(gsac.saclist, sortby, sortincrease) return
def sortSeis(self): sortincrease = True if self.opts.sortby == 'i': self.sacgroup.selist, self.sacgroup.delist = seleSeis(self.sacgroup.saclist) elif self.opts.sortby == 't': ipick = self.opts.qcpara.ichdrs[0] wpick = 't' + str(self.opts.reltime) if ipick == wpick: print ('Same time pick: {0:s} and {1:s}. Exit'.format(ipick, wpick)) sys.exit() self.sacgroup.selist, self.sacgroup.delist = sortSeisHeaderDiff(self.sacgroup.saclist, ipick, wpick, sortincrease) elif self.opts.sortby.isdigit() or self.opts.sortby in self.opts.qheaders + ['all',]: if self.opts.sortby == '1' or self.opts.sortby == 'ccc': self.opts.qweights = [1, 0, 0] elif self.opts.sortby == '2' or self.opts.sortby == 'snr': self.opts.qweights = [0, 1, 0] elif self.opts.sortby == '3' or self.opts.sortby == 'coh': self.opts.qweights = [0, 0, 1] self.sacgroup.selist, self.sacgroup.delist = sortSeisQual(self.sacgroup.saclist, self.opts.qheaders, self.opts.qweights, self.opts.qfactors, sortincrease) else: self.sacgroup.selist, self.sacgroup.delist = sortSeisHeader(self.sacgroup.saclist, self.opts.sortby, sortincrease)