当前位置: 首页>>代码示例>>Python>>正文


Python arclink.Client类代码示例

本文整理汇总了Python中obspy.clients.arclink.Client的典型用法代码示例。如果您正苦于以下问题:Python Client类的具体用法?Python Client怎么用?Python Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Client类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_waveform

 def test_get_waveform(self):
     """
     Tests get_waveforms method.
     """
     # example 1
     client = Client(user='[email protected]')
     start = UTCDateTime(2010, 1, 1)
     end = start + 1
     stream = client.get_waveforms('BW', 'MANZ', '', 'EH*', start, end)
     self.assertEqual(len(stream), 3)
     for trace in stream:
         self.assertLessEqual(trace.stats.starttime, start)
         self.assertGreaterEqual(trace.stats.endtime, end)
         self.assertEqual(trace.stats.network, 'BW')
         self.assertEqual(trace.stats.station, 'MANZ')
         self.assertEqual(trace.stats.location, '')
         self.assertEqual(trace.stats.channel[0:2], 'EH')
     # example 2
     client = Client(user='[email protected]')
     start = UTCDateTime("2010-12-31T23:59:50.495000Z")
     end = start + 100
     stream = client.get_waveforms('GE', 'APE', '', 'BHE', start, end)
     self.assertEqual(len(stream), 1)
     trace = stream[0]
     self.assertLessEqual(trace.stats.starttime, start)
     self.assertGreaterEqual(trace.stats.endtime, end)
     self.assertEqual(trace.stats.network, 'GE')
     self.assertEqual(trace.stats.station, 'APE')
     self.assertEqual(trace.stats.location, '')
     self.assertEqual(trace.stats.channel, 'BHE')
开发者ID:Qigaoo,项目名称:obspy,代码行数:30,代码来源:test_client.py

示例2: test_getWaveform

 def test_getWaveform(self):
     """
     Tests get_waveforms method.
     """
     # example 1
     client = Client(user="[email protected]")
     start = UTCDateTime(2010, 1, 1)
     end = start + 1
     stream = client.get_waveforms("BW", "MANZ", "", "EH*", start, end)
     self.assertEqual(len(stream), 3)
     for trace in stream:
         self.assertLessEqual(trace.stats.starttime, start)
         self.assertGreaterEqual(trace.stats.endtime, end)
         self.assertEqual(trace.stats.network, "BW")
         self.assertEqual(trace.stats.station, "MANZ")
         self.assertEqual(trace.stats.location, "")
         self.assertEqual(trace.stats.channel[0:2], "EH")
     # example 2
     client = Client(user="[email protected]")
     start = UTCDateTime("2010-12-31T23:59:50.495000Z")
     end = start + 100
     stream = client.get_waveforms("GE", "APE", "", "BHE", start, end)
     self.assertEqual(len(stream), 1)
     trace = stream[0]
     self.assertLessEqual(trace.stats.starttime, start)
     self.assertGreaterEqual(trace.stats.endtime, end)
     self.assertEqual(trace.stats.network, "GE")
     self.assertEqual(trace.stats.station, "APE")
     self.assertEqual(trace.stats.location, "")
     self.assertEqual(trace.stats.channel, "BHE")
开发者ID:yyuzhong,项目名称:obspy,代码行数:30,代码来源:test_client.py

示例3: test_get_inventory_stationgroup

 def test_get_inventory_stationgroup(self):
     """
     Tests get_inventory method for StationGroup, issue #1756.
     """
     client = Client(user='[email protected]')
     # 1 - defined @INGV
     with warnings.catch_warnings(record=True) as w:
         warnings.filterwarnings("always")
         result = client.get_inventory(network="_NFOTABOO", route=True)
     self.assertEqual(len(w), 1)
     self.assertEqual(
         str(w[0].message),
         "Routing was requested but parameter 'network' is '_NFOTABOO' "
         "and therefore routing is disabled.")
     self.assertIn('IV', result)
     self.assertIn('IV.ATBU', result)
     self.assertIn('IV.SSFR', result)
     # 2 - defined @NIEP
     result = client.get_inventory(network="_NFOVRANC", route=False)
     self.assertIn('RO', result)
     self.assertIn('RO.BISRR', result)
     self.assertIn('RO.VRI', result)
     # 3 - defined @ETH
     result = client.get_inventory(network="_NFOVALAIS")
     self.assertIn('CH', result)
     self.assertIn('S', result)
     self.assertIn('7H', result)
     self.assertIn('CH.AIGLE', result)
     self.assertIn('CH.VANNI', result)
     self.assertIn('S.ESION', result)
开发者ID:FMassin,项目名称:obspy,代码行数:30,代码来源:test_client.py

示例4: test_getPAZ

    def test_getPAZ(self):
        """
        Test for the Client.get_paz function.

        As reference the EHZ channel of MANZ is taken, the result is compared
        to the entries of the local response file of the Bavarian network.
        """
        # reference values
        zeros = [0j, 0j]
        poles = [
            -3.700400e-02 + 3.701600e-02j,
            -3.700400e-02 - 3.701600e-02j,
            -2.513300e02 + 0.000000e00j,
            -1.310400e02 - 4.672900e02j,
            -1.310400e02 + 4.672900e02j,
        ]
        normalization_factor = 6.0077e07
        sensitivity = 2.5168e09
        # initialize client
        client = Client("erde.geophysik.uni-muenchen.de", 18001, user="[email protected]")
        # fetch poles and zeros
        dt = UTCDateTime(2009, 1, 1)
        paz = client.get_paz("BW", "MANZ", "", "EHZ", dt)
        # compare instrument
        self.assertEqual(normalization_factor, paz.normalization_factor)
        self.assertEqual(poles, paz.poles)
        self.assertEqual(zeros, paz.zeros)
        self.assertAlmostEqual(sensitivity / 1e9, paz.sensitivity / 1e9, 4)
        # PAZ over multiple channels should raise an exception
        self.assertRaises(ArcLinkException, client.get_paz, "BW", "MANZ", "", "EH*", dt)
开发者ID:yyuzhong,项目名称:obspy,代码行数:30,代码来源:test_client.py

示例5: test_save_waveform_compressed

 def test_save_waveform_compressed(self):
     """
     Tests saving compressed and not unpacked bzip2 files to disk.
     """
     # initialize client
     client = Client(user='[email protected]')
     start = UTCDateTime(2008, 1, 1, 0, 0)
     end = start + 1
     # MiniSEED
     with NamedTemporaryFile(suffix='.bz2') as tf:
         mseedfile = tf.name
         client.save_waveforms(mseedfile, 'GE', 'APE', '', 'BHZ', start,
                               end, unpack=False)
         # check if compressed
         with open(mseedfile, 'rb') as fp:
             self.assertEqual(fp.read(2), b'BZ')
         # importing via read should work too
         read(mseedfile)
     # Full SEED
     with NamedTemporaryFile(suffix='.bz2') as tf:
         fseedfile = tf.name
         client.save_waveforms(fseedfile, 'GE', 'APE', '', 'BHZ', start,
                               end, format="FSEED", unpack=False)
         # check if compressed
         with open(fseedfile, 'rb') as fp:
             self.assertEqual(fp.read(2), b'BZ')
         # importing via read should work too
         read(fseedfile)
开发者ID:Brtle,项目名称:obspy,代码行数:28,代码来源:test_client.py

示例6: test_get_inventory_stationgroup

 def test_get_inventory_stationgroup(self):
     """
     Tests get_inventory method for StationGroup, issue #1756.
     """
     client = Client(user='[email protected]')
     # 1 - defined @INGV
     with warnings.catch_warnings(record=True) as w:
         warnings.filterwarnings("always")
         result = client.get_inventory(network="_NFOTABOO", route=True)
     self.assertEqual(len(w), 1)
     self.assertEqual(
         str(w[0].message),
         "Routing was requested but parameter 'network' is '_NFOTABOO' "
         "and therefore routing is disabled.")
     self.assertIn('IV', result)
     self.assertIn('IV.ATBU', result)
     self.assertIn('IV.SSFR', result)
     # 2 - defined @NIEP
     result = client.get_inventory(network="_NFOVRANC", route=False)
     self.assertIn('RO', result)
     self.assertIn('RO.BISRR', result)
     self.assertIn('RO.VRI', result)
     # 3 - defined @ETH
     result = client.get_inventory(
         network="_NFOVALAIS", starttime=UTCDateTime(2017, 10, 16),
         endtime=UTCDateTime(2017, 10, 19))
     self.assertIn('CH', result)
     self.assertIn('S', result)
     # self.assertIn('7H', result) This network does not appear to be
     # included in the _NFOVALAIS network anymore. Checked on 03/12/2018
     # at http://eida.gfz-potsdam.de/webdc3/
     self.assertIn('CH.AIGLE', result)
     self.assertIn('CH.VANNI', result)
     self.assertIn('S.ESION', result)
开发者ID:Brtle,项目名称:obspy,代码行数:34,代码来源:test_client.py

示例7: test_get_stations

 def test_get_stations(self):
     """
     """
     # initialize client
     client = Client(user='[email protected]')
     # 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)
开发者ID:Brtle,项目名称:obspy,代码行数:35,代码来源:test_client.py

示例8: test_getStations

 def test_getStations(self):
     """
     """
     # initialize client
     client = Client(user="[email protected]")
     # 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
     )
开发者ID:yyuzhong,项目名称:obspy,代码行数:30,代码来源:test_client.py

示例9: test_get_waveform

 def test_get_waveform(self):
     """
     Tests get_waveforms method.
     """
     # example 1
     client = Client(user='[email protected]')
     start = UTCDateTime(2010, 1, 1)
     end = start + 1
     stream = client.get_waveforms('BW', 'MANZ', '', 'EH*', start, end)
     self.assertEqual(len(stream), 3)
     for trace in stream:
         self.assertLessEqual(trace.stats.starttime, start)
         self.assertGreaterEqual(trace.stats.endtime, end)
         self.assertEqual(trace.stats.network, 'BW')
         self.assertEqual(trace.stats.station, 'MANZ')
         self.assertEqual(trace.stats.location, '')
         self.assertEqual(trace.stats.channel[0:2], 'EH')
     # example 2
     client = Client(user='[email protected]')
     start = UTCDateTime("2010-12-31T23:59:50.495000Z")
     end = start + 100
     stream = client.get_waveforms('GE', 'APE', '', 'BHE', start, end)
     # seems the response of the server has changed, it contains two traces
     # with an overlap now but the data is consistent and a cleanup merge
     # works
     stream.merge(-1)
     self.assertEqual(len(stream), 1)
     trace = stream[0]
     self.assertLessEqual(trace.stats.starttime, start)
     self.assertGreaterEqual(trace.stats.endtime, end)
     self.assertEqual(trace.stats.network, 'GE')
     self.assertEqual(trace.stats.station, 'APE')
     self.assertEqual(trace.stats.location, '')
     self.assertEqual(trace.stats.channel, 'BHE')
开发者ID:Brtle,项目名称:obspy,代码行数:34,代码来源:test_client.py

示例10: test_getWaveformInstrumentChange

    def test_getWaveformInstrumentChange(self):
        """
        Check results of get_waveforms if instrumentation has been changed.

        Sensitivity change for GE.SNAA..BHZ at 2003-01-10T00:00:00
        """
        client = Client(user="[email protected]")
        # one instrument in given time span
        dt = UTCDateTime("2003-01-09T00:00:00")
        st = client.get_waveforms("GE", "SNAA", "", "BHZ", dt, dt + 10, metadata=True)
        self.assertEqual(len(st), 1)
        self.assertEqual(st[0].stats.paz.sensitivity, 596224500.0)
        # two instruments in given time span
        dt = UTCDateTime("2003-01-09T23:59:00")
        st = client.get_waveforms("GE", "SNAA", "", "BHZ", dt, dt + 120, metadata=True)
        # results into two traces
        self.assertEqual(len(st), 2)
        # with different PAZ
        st.sort()
        self.assertEqual(st[0].stats.paz.sensitivity, 596224500.0)
        self.assertEqual(st[1].stats.paz.sensitivity, 588000000.0)
        # one instrument in given time span
        dt = UTCDateTime("2003-01-10T01:00:00")
        st = client.get_waveforms("GE", "SNAA", "", "BHZ", dt, dt + 10, metadata=True)
        self.assertEqual(len(st), 1)
        self.assertEqual(st[0].stats.paz.sensitivity, 588000000.0)
开发者ID:yyuzhong,项目名称:obspy,代码行数:26,代码来源:test_client.py

示例11: test_saveWaveformCompressed

 def test_saveWaveformCompressed(self):
     """
     Tests saving compressed and not unpacked bzip2 files to disk.
     """
     # initialize client
     client = Client(user="[email protected]")
     start = UTCDateTime(2008, 1, 1, 0, 0)
     end = start + 1
     # MiniSEED
     with NamedTemporaryFile(suffix=".bz2") as tf:
         mseedfile = tf.name
         client.save_waveforms(mseedfile, "GE", "APE", "", "BHZ", start, end, unpack=False)
         # check if compressed
         with open(mseedfile, "rb") as fp:
             self.assertEqual(fp.read(2), b"BZ")
         # importing via read should work too
         read(mseedfile)
     # Full SEED
     with NamedTemporaryFile(suffix=".bz2") as tf:
         fseedfile = tf.name
         client.save_waveforms(fseedfile, "GE", "APE", "", "BHZ", start, end, format="FSEED", unpack=False)
         # check if compressed
         with open(fseedfile, "rb") as fp:
             self.assertEqual(fp.read(2), b"BZ")
         # importing via read should work too
         read(fseedfile)
开发者ID:yyuzhong,项目名称:obspy,代码行数:26,代码来源:test_client.py

示例12: test_get_networks

 def test_get_networks(self):
     """
     """
     # initialize client
     client = Client(user='[email protected]')
     # example 1
     start = UTCDateTime(2008, 1, 1)
     end = start + 1
     result = client.get_networks(start, end)
     self.assertIn('BW', result.keys())
     self.assertEqual(result['BW']['code'], 'BW')
     self.assertEqual(result['BW']['description'], 'BayernNetz')
开发者ID:Brtle,项目名称:obspy,代码行数:12,代码来源:test_client.py

示例13: test_get_inventory_twice

 def test_get_inventory_twice(self):
     """
     Requesting inventory data twice should not fail.
     """
     client = Client(user='[email protected]')
     dt = UTCDateTime(2009, 1, 1)
     # station
     client.get_inventory('BW', 'MANZ', starttime=dt, endtime=dt + 1)
     client.get_inventory('BW', 'MANZ', starttime=dt, endtime=dt + 1)
     # network
     client.get_inventory('BW', starttime=dt, endtime=dt + 1)
     client.get_inventory('BW', starttime=dt, endtime=dt + 1)
开发者ID:Brtle,项目名称:obspy,代码行数:12,代码来源:test_client.py

示例14: test_getInventoryTwice

 def test_getInventoryTwice(self):
     """
     Requesting inventory data twice should not fail.
     """
     client = Client(user="[email protected]")
     dt = UTCDateTime(2009, 1, 1)
     # station
     client.get_inventory("BW", "MANZ", starttime=dt, endtime=dt + 1)
     client.get_inventory("BW", "MANZ", starttime=dt, endtime=dt + 1)
     # network
     client.get_inventory("BW", starttime=dt, endtime=dt + 1)
     client.get_inventory("BW", starttime=dt, endtime=dt + 1)
开发者ID:yyuzhong,项目名称:obspy,代码行数:12,代码来源:test_client.py

示例15: test_getNetworks

 def test_getNetworks(self):
     """
     """
     # initialize client
     client = Client(user="[email protected]")
     # example 1
     start = UTCDateTime(2008, 1, 1)
     end = start + 1
     result = client.get_networks(start, end)
     self.assertIn("BW", result.keys())
     self.assertEqual(result["BW"]["code"], "BW")
     self.assertEqual(result["BW"]["description"], "BayernNetz")
开发者ID:yyuzhong,项目名称:obspy,代码行数:12,代码来源:test_client.py


注:本文中的obspy.clients.arclink.Client类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。