Esempio n. 1
0
 def test_getStations(self):
     """
     """
     # initialize client
     client = Client(user='******')
     # example 1
     start = UTCDateTime(2008, 1, 1)
     end = start + 1
     result = client.getStations(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)
Esempio n. 2
0
 def test_getStations(self):
     """
     """
     # initialize client
     client = Client(user='******')
     # example 1
     start = UTCDateTime(2008, 1, 1)
     end = start + 1
     result = client.getStations(start, end, 'BW')
     self.assertTrue(
         AttribDict({'remark': '', 'code': 'RWMO', 'elevation': 763.0,
                     'description': 'Wildenmoos, Bavaria',
                     'start': UTCDateTime(2006, 6, 4, 0, 0),
                     'restricted': False, 'archive_net': '',
                     'longitude': 12.729887, 'affiliation': '',
                     'depth': None, 'place': '', 'country': '',
                     'latitude': 47.744172, 'end': None}) in result)
from obspy.core.util.geodetics import gps2DistAzimuth
from obspy.arclink import Client
from math import log10
from numpy import median

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.getStations(t, t + 300, "CH")
mags = []

for station in stations:
    station = station['code']
    try:
        st = client.getWaveform("CH",
                                station,
                                "",
                                "[EH]H[ZNE]",
                                t - 300,
                                t + 300,
                                metadata=True)
        assert (len(st) == 3)
    except:
        print station, "---"
for trig in triglist:
    closest_sta = trig['stations'][0]
    tr = st.select(station=closest_sta)[0]
    trig['latitude'] = tr.stats.coordinates.latitude
    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.getStations(t, t + 300, "CH")

    for station in stations:
        station = station['code']
        try:
            st = client.getWaveform("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]