Ejemplo n.º 1
0
def get_waveforms():
    events = get_events()[::-1]
    client = Client('GFZ')
    stream_raw = Stream()
    stream = RFStream()
    coords = inventory.get_coordinates(seedid[:-1] + 'Z')
    for i, event in enumerate(events):
        t = event.preferred_origin().time
        args = seedid.split('.') + [t + 4.9 * 60, t + 14.1 * 60]
        s = client.get_waveforms(*args)
        s.trim(t + 5 * 60, t + 14 * 60)
        s.decimate(int(round(s[0].stats.sampling_rate)) // 5, no_filter=True)
        stream_raw.extend(s)
        if i in (0, 2, 4):
            s = s.copy()
            stats = rfstats(station=coords, event=event, dist_range=(20, 95))
            if stats is None:
                continue
            s.trim(stats.onset - 25, stats.onset + 75)
            stats = obj2stats(station=coords, event=event)
            s = RFStream(s)
            for tr in s:
                tr.stats.update(stats)
            stream.extend(s)
    stream_raw.write(wavname, 'MSEED')
    stream.write(wavname2, 'SAC')
Ejemplo n.º 2
0
def get_waveforms():
    events = get_events()[::-1]
    client = Client('GFZ')
    stream_raw = Stream()
    stream = RFStream()
    coords = inventory.get_coordinates(seedid[:-1] + 'Z')
    for i, event in enumerate(events):
        t = event.preferred_origin().time
        args = seedid.split('.') + [t + 4.9 * 60, t + 14.1 * 60]
        s = client.get_waveforms(*args)
        s.trim(t+5*60, t+14*60)
        s.decimate(int(round(s[0].stats.sampling_rate)) // 5, no_filter=True)
        stream_raw.extend(s)
        if i in (0, 2, 4):
            s = s.copy()
            stats = rfstats(station=coords, event=event, dist_range=(20, 95))
            if stats is None:
                continue
            s.trim(stats.onset - 25, stats.onset + 75)
            stats = obj2stats(station=coords, event=event)
            s = RFStream(s)
            for tr in s:
                tr.stats.update(stats)
            stream.extend(s)
    stream_raw.write(wavname, 'MSEED')
    stream.write(wavname2, 'SAC')
Ejemplo n.º 3
0
 def test_obj2stats(self):
     stats = obj2stats(event=self.event, station=self.station)
     for head, _ in _STATION_GETTER + _EVENT_GETTER:
         self.assertIn(head, stats)
Ejemplo n.º 4
0
 def test_obj2stats(self):
     stats = obj2stats(event=self.event, station=self.station)
     for head, _ in STATION_GETTER + EVENT_GETTER:
         self.assertIn(head, stats)