def test_get_stations(self): """ """ # initialize client client = Client(user='******') # example 1 start = UTCDateTime(2008, 1, 1) end = start + 1 result = client.get_stations(start, end, 'BW') self.assertTrue( AttribDict({'remark': '', 'code': 'RWMO', 'elevation': 763.0, 'description': 'Wildenmoos, Bavaria, BW-Net', 'start': UTCDateTime(2006, 7, 4, 0, 0), 'restricted': False, 'archive_net': '', 'longitude': 12.729887, 'affiliation': 'BayernNetz', 'depth': None, 'place': 'Wildenmoos', 'country': 'BW-Net', 'latitude': 47.744171, 'end': None}) in result) # example 2 expected = AttribDict( {'code': 'WDD', 'description': 'Wied Dalam', 'affiliation': '', 'country': '', 'place': '', 'remark': '', 'restricted': False, 'archive_net': '', 'latitude': 35.8373, 'longitude': 14.5242, 'elevation': 44.0, 'depth': None, 'start': UTCDateTime(1995, 7, 6, 0, 0), 'end': None}) # routing default result = client.get_stations(start, end, 'MN') self.assertTrue(expected in result) # w/o routing result = client.get_stations(start, end, 'MN', route=False) self.assertTrue(expected in result) # w/ routing result = client.get_stations(start, end, 'MN', route=True) self.assertTrue(expected in result)
def test_get_stations_inconsistency(self): """ """ # initialize client client = Client(user='******') # example 1 start = UTCDateTime(2008, 1, 1) end = start + 1 result_origin = AttribDict({ 'remark': '', 'code': 'RWMO', 'elevation': 763.0, 'description': 'Wildenmoos, Bavaria, BW-Net', 'start': UTCDateTime(2006, 7, 4, 0, 0), 'restricted': False, 'archive_net': '', 'longitude': 12.729887, 'affiliation': 'BayernNetz', 'depth': None, 'place': 'Wildenmoos', 'country': ' BW-Net', 'latitude': 47.744171, 'end': None }) # OK: from origin node result = client.get_stations(start, end, 'BW', route=True) self.assertTrue(result_origin in result) # BUT: this one from a different node was modified and fails result = client.get_stations(start, end, 'BW') self.assertTrue(result_origin in result)
def test_getStations(self): """ """ # initialize client client = Client(user="******") # example 1 start = UTCDateTime(2008, 1, 1) end = start + 1 result = client.get_stations(start, end, "BW") self.assertTrue( AttribDict( { "remark": "", "code": "RWMO", "elevation": 763.0, "description": "Wildenmoos, Bavaria, BW-Net", "start": UTCDateTime(2006, 7, 4, 0, 0), "restricted": False, "archive_net": "", "longitude": 12.729887, "affiliation": "BayernNetz", "depth": None, "place": "Wildenmoos", "country": " BW-Net", "latitude": 47.744171, "end": None, } ) in result )
def test_get_stations(self): """ """ # initialize client client = Client(user='******') # example 1 start = UTCDateTime(2008, 1, 1) end = start + 1 result = client.get_stations(start, end, 'BW') self.assertTrue( AttribDict({ 'remark': '', 'code': 'RWMO', 'elevation': 763.0, 'description': 'Wildenmoos, Bavaria, BW-Net', 'start': UTCDateTime(2006, 7, 4, 0, 0), 'restricted': False, 'archive_net': '', 'longitude': 12.729887, 'affiliation': 'BayernNetz', 'depth': None, 'place': 'Wildenmoos', 'country': ' BW-Net', 'latitude': 47.744171, 'end': None }) in result)
def test_get_stations_inconsistency(self): """ """ # initialize client client = Client(user='******') # example 1 start = UTCDateTime(2008, 1, 1) end = start + 1 result_origin = AttribDict( {'remark': '', 'code': 'RWMO', 'elevation': 763.0, 'description': 'Wildenmoos, Bavaria, BW-Net', 'start': UTCDateTime(2006, 7, 4, 0, 0), 'restricted': False, 'archive_net': '', 'longitude': 12.729887, 'affiliation': 'BayernNetz', 'depth': None, 'place': 'Wildenmoos', 'country': ' BW-Net', 'latitude': 47.744171, 'end': None}) # OK: from origin node result = client.get_stations(start, end, 'BW', route=True) self.assertTrue(result_origin in result) # BUT: this one from a different node was modified and fails result = client.get_stations(start, end, 'BW') self.assertTrue(result_origin in result)
def test_get_stations(self): """ """ # initialize client client = Client(user='******') # example 1 start = UTCDateTime(2008, 1, 1) end = start + 1 result = client.get_stations(start, end, 'BW') self.assertTrue( AttribDict({'remark': '', 'code': 'RWMO', 'elevation': 763.0, 'description': 'Wildenmoos, Bavaria, BW-Net', 'start': UTCDateTime(2006, 7, 4, 0, 0), 'restricted': False, 'archive_net': '', 'longitude': 12.729887, 'affiliation': 'BayernNetz', 'depth': None, 'place': 'Wildenmoos', 'country': ' BW-Net', 'latitude': 47.744171, 'end': None}) in result)
from math import log10 import numpy as np from obspy.clients.arclink import Client from obspy import UTCDateTime from obspy.geodetics import gps2dist_azimuth paz_wa = {"sensitivity": 2800, "zeros": [0j], "gain": 1, "poles": [-6.2832 - 4.7124j, -6.2832 + 4.7124j]} client = Client(user="******") t = UTCDateTime("2012-04-03T02:45:03") stations = client.get_stations(t, t + 300, "CH") mags = [] for station in stations: station = station["code"] try: st = client.get_waveforms("CH", station, "", "[EH]H[ZNE]", t - 300, t + 300, metadata=True) assert len(st) == 3 except: print(station, "---") continue st.simulate(paz_remove="self", paz_simulate=paz_wa, water_level=10) st.trim(t, t + 50) tr_n = st.select(component="N")[0]
trig['longitude'] = tr.stats.coordinates.longitude paz_wa = { 'sensitivity': 2800, 'zeros': [0j], 'gain': 1, 'poles': [-6.2832 - 4.7124j, -6.2832 + 4.7124j] } for trig in triglist: t = trig['time'] print("#" * 80) print("Trigger time:", t) mags = [] stations = client.get_stations(t, t + 300, "CH") for station in stations: station = station['code'] try: st = client.get_waveforms("CH", station, "", "[EH]H[ZNE]", t - 300, t + 300, metadata=True) assert (len(st) == 3) except: print(station, "---") continue