def express_zne(): ''' get z,n,e components ''' stz = obspy.read('*BHZ*filtered') stz = filter.gimp_filter(stz) stn = obspy.read('*BHN*filtered') stn = filter.gimp_filter(stn) ste = obspy.read('*BHE*filtered') ste = filter.gimp_filter(ste) stz.normalize() stn.normalize() ste.normalize() stz = data.align_on_phase(stz) stn = data.align_on_phase(stn) ste = data.align_on_phase(ste) return stz, stn, ste
def express_rt(): ''' get r and t ''' stn = obspy.read('*BHN*filtered') ste = obspy.read('*BHE*filtered') stz = obspy.read('*BHZ*filtered') stn = filter.gimp_filter(stn) ste = filter.gimp_filter(ste) stz = filter.gimp_filter(stz) stn_name_list = [] ste_name_list = [] stz_name_list = [] for tr in stn: tr.stats.full_name = tr.stats.network+'.'+tr.stats.station stn_name_list.append(tr.stats.network+'.'+tr.stats.station) for tr in ste: tr.stats.full_name = tr.stats.network+'.'+tr.stats.station ste_name_list.append(tr.stats.network+'.'+tr.stats.station) for tr in stz: tr.stats.full_name = tr.stats.network+'.'+tr.stats.station stz_name_list.append(tr.stats.network+'.'+tr.stats.station) common_name = set(stn_name_list) & set(ste_name_list) & set(stz_name_list) for tr in stn: if tr.stats.full_name not in common_name: stn.remove(tr) for tr in ste: if tr.stats.full_name not in common_name: ste.remove(tr) for tr in stz: if tr.stats.full_name not in common_name: stz.remove(tr) stz.sort(['full_name']) ste.sort(['full_name']) stn.sort(['full_name']) str, stt = rotate_st(stn,ste) return str, stt, stz
def express_rt(): ''' get r and t ''' stn = obspy.read('*BHN*filtered') ste = obspy.read('*BHE*filtered') stz = obspy.read('*BHZ*filtered') stn = filter.gimp_filter(stn) ste = filter.gimp_filter(ste) stz = filter.gimp_filter(stz) stn_name_list = [] ste_name_list = [] stz_name_list = [] for tr in stn: tr.stats.full_name = tr.stats.network + '.' + tr.stats.station stn_name_list.append(tr.stats.network + '.' + tr.stats.station) for tr in ste: tr.stats.full_name = tr.stats.network + '.' + tr.stats.station ste_name_list.append(tr.stats.network + '.' + tr.stats.station) for tr in stz: tr.stats.full_name = tr.stats.network + '.' + tr.stats.station stz_name_list.append(tr.stats.network + '.' + tr.stats.station) common_name = set(stn_name_list) & set(ste_name_list) & set(stz_name_list) for tr in stn: if tr.stats.full_name not in common_name: stn.remove(tr) for tr in ste: if tr.stats.full_name not in common_name: ste.remove(tr) for tr in stz: if tr.stats.full_name not in common_name: stz.remove(tr) stz.sort(['full_name']) ste.sort(['full_name']) stn.sort(['full_name']) str, stt = rotate_st(stn, ste) return str, stt, stz
def express_all(): ''' get r and t z n e ''' stn = obspy.read('*BHN*filtered') ste = obspy.read('*BHE*filtered') stz = obspy.read('*BHZ*filtered') stn_name_list = [] ste_name_list = [] stz_name_list = [] stn = filter.gimp_filter(stn) ste = filter.gimp_filter(ste) stz = filter.gimp_filter(stz) for tr in stn: tr.stats.full_name = tr.stats.network + '.' + tr.stats.station + '.' #str(tr.stats.calib) if tr.stats.full_name in stn_name_list: stn.remove(tr) stn_name_list.append(tr.stats.full_name) for tr in ste: tr.stats.full_name = tr.stats.network + '.' + tr.stats.station + '.' #str(tr.stats.calib) if tr.stats.full_name in ste_name_list: ste.remove(tr) ste_name_list.append(tr.stats.full_name) for tr in stz: tr.stats.full_name = tr.stats.network + '.' + tr.stats.station + '.' #str(tr.stats.calib) if tr.stats.full_name in stz_name_list: stz.remove(tr) stz_name_list.append(tr.stats.full_name) #common_name = set(stn_name_list)|set(ste_name_list)|set(stz_name_list) #full_name = set(stz_name_list+ste_name_list+stn_name_list) #common_list = min(len(set(stn_name_list)),len(set(stz_name_list)),len(set(ste_name_list))) #return common_name,full_name common_name = set(stn_name_list) & set(ste_name_list) & set(stz_name_list) for tr in stn: if tr.stats.full_name not in common_name: stn.remove(tr) for tr in ste: if tr.stats.full_name not in common_name: ste.remove(tr) for tr in stz: if tr.stats.full_name not in common_name: stz.remove(tr) stz.sort(['full_name']) ste.sort(['full_name']) stn.sort(['full_name']) print len(stn), len(ste), len(stz) if (len(stn[0].data) == len(ste[0].data) == len(stz[0].data)) == False: new_len = min(len(stn[0].data), len(ste[0].data), len(stz[0].data)) for idx, tr in enumerate(stn): tr.data = tr.data[0:new_len - 1] ste[idx].data = ste[idx].data[0:new_len - 1] stz[idx].data = stz[idx].data[0:new_len - 1] strad, stt = rotate_st(stn, ste) #return common_name return strad, stt, stz, ste, stn
def express_all(): """ get r and t z n e """ stn = obspy.read("*BHN*filtered") ste = obspy.read("*BHE*filtered") stz = obspy.read("*BHZ*filtered") stn_name_list = [] ste_name_list = [] stz_name_list = [] stn = filter.gimp_filter(stn) ste = filter.gimp_filter(ste) stz = filter.gimp_filter(stz) for tr in stn: tr.stats.full_name = tr.stats.network + "." + tr.stats.station + "." # str(tr.stats.calib) if tr.stats.full_name in stn_name_list: stn.remove(tr) stn_name_list.append(tr.stats.full_name) for tr in ste: tr.stats.full_name = tr.stats.network + "." + tr.stats.station + "." # str(tr.stats.calib) if tr.stats.full_name in ste_name_list: ste.remove(tr) ste_name_list.append(tr.stats.full_name) for tr in stz: tr.stats.full_name = tr.stats.network + "." + tr.stats.station + "." # str(tr.stats.calib) if tr.stats.full_name in stz_name_list: stz.remove(tr) stz_name_list.append(tr.stats.full_name) # common_name = set(stn_name_list)|set(ste_name_list)|set(stz_name_list) # full_name = set(stz_name_list+ste_name_list+stn_name_list) # common_list = min(len(set(stn_name_list)),len(set(stz_name_list)),len(set(ste_name_list))) # return common_name,full_name common_name = set(stn_name_list) & set(ste_name_list) & set(stz_name_list) for tr in stn: if tr.stats.full_name not in common_name: stn.remove(tr) for tr in ste: if tr.stats.full_name not in common_name: ste.remove(tr) for tr in stz: if tr.stats.full_name not in common_name: stz.remove(tr) stz.sort(["full_name"]) ste.sort(["full_name"]) stn.sort(["full_name"]) print len(stn), len(ste), len(stz) if (len(stn[0].data) == len(ste[0].data) == len(stz[0].data)) == False: new_len = min(len(stn[0].data), len(ste[0].data), len(stz[0].data)) for idx, tr in enumerate(stn): tr.data = tr.data[0 : new_len - 1] ste[idx].data = ste[idx].data[0 : new_len - 1] stz[idx].data = stz[idx].data[0 : new_len - 1] strad, stt = rotate_st(stn, ste) # return common_name return strad, stt, stz, ste, stn