def get_waveforms(): events = get_events() client = ArcClient(**client_kwargs) wforms = Stream() for i, event in enumerate(events): print('Fetch data for event no. %d' % (i + 1)) t = event.preferred_origin().time for sta in stations: args = (net, sta, loc, cha, t - 10, t + 220) try: stream = client.getWaveform(*args) except: print('no data for %s' % (args, )) continue sr = stream[0].stats.sampling_rate stream.decimate(int(sr) // 20, no_filter=True) for tr in stream: del tr.stats.mseed stream.merge() wforms.extend(stream) wforms.write(wavname, wavformat) return wforms
def make_arcObspyrequest(station, begin, end, channel, loc, pwdkeys): print 'INOBSPY ', pwdkeys, type(pwdkeys) print 'Obspy ARCLINKREQUEST FOR STATION ' size = 0 rstation = station.split('_') if loc == '--': loc = '' # client = Client(user=_mail,dcid_keys=pwdkeys,timeout = 5) #hs - Lutz client = Client(user=_mail, dcid_keys=pwdkeys, timeout=120) #hs st = Stream() #for i in channel: # try: st += client.getWaveform(rstation[0], rstation[1], loc, i, begin, end) # except: continue # ArclinkException: No data available #endfor try: st += client.getWaveform(rstation[0], rstation[1], loc, '*', begin, end) #hs v2 except: return 0 print 'INOBS ', rstation, channel streamList = [] for i in st: streamList.append(i.stats.channel) #if len(set(streamList)) == len(channel): size = proof_file_v3(st, channel) #hs #else: size = 0 #hs size = proof_file_v3(st, channel) #hs return size