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


Python Client.get_waveforms方法代码示例

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


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

示例1: test_get_waveform

# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_waveforms [as 别名]
 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,代码行数:36,代码来源:test_client.py

示例2: test_getWaveformInstrumentChange

# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_waveforms [as 别名]
    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,代码行数:28,代码来源:test_client.py

示例3: test_get_waveform

# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_waveforms [as 别名]
 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,代码行数:32,代码来源:test_client.py

示例4: test_getWaveform

# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_waveforms [as 别名]
 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,代码行数:32,代码来源:test_client.py

示例5: test_issue311

# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_waveforms [as 别名]
 def test_issue311(self):
     """
     Testing issue #311.
     """
     client = Client("webdc.eu", 18001, user="[email protected]")
     t = UTCDateTime("2009-08-20 04:03:12")
     # 1
     st = client.get_waveforms("BW", "MANZ", "", "EH*", t - 3, t + 15, metadata=False)
     self.assertEqual(len(st), 3)
     self.assertNotIn("paz", st[0].stats)
     self.assertNotIn("coordinates", st[0].stats)
     # 2
     st = client.get_waveforms("BW", "MANZ", "", "EH*", t - 3, t + 15, metadata=True)
     self.assertEqual(len(st), 3)
     self.assertIn("paz", st[0].stats)
     self.assertIn("coordinates", st[0].stats)
开发者ID:yyuzhong,项目名称:obspy,代码行数:18,代码来源:test_client.py

示例6: test_get_waveform_with_dcid_key

# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_waveforms [as 别名]
 def test_get_waveform_with_dcid_key(self):
     """
     """
     # test server for encryption
     client1 = Client(host="webdc.eu", port=36000, user="[email protected]",
                      dcid_keys={'BIA': 'OfH9ekhi'})
     # public server
     client2 = Client(host="webdc.eu", port=18001, user="[email protected]")
     # request data
     start = UTCDateTime(2010, 1, 1, 10, 0, 0)
     end = start + 100
     stream1 = client1.get_waveforms('GE', 'APE', '', 'BHZ', start, end)
     stream2 = client2.get_waveforms('GE', 'APE', '', 'BHZ', start, end)
     # compare results
     np.testing.assert_array_equal(stream1[0].data, stream2[0].data)
     self.assertEqual(stream1[0].stats, stream2[0].stats)
开发者ID:Abushalaa,项目名称:obspy,代码行数:18,代码来源:test_decrypt.py

示例7: test_issue_311

# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_waveforms [as 别名]
 def test_issue_311(self):
     """
     Testing issue #311.
     """
     client = Client('[email protected]', host='webdc.eu', port=18001)
     t = UTCDateTime("2009-08-20 04:03:12")
     # 1
     st = client.get_waveforms("BW", "MANZ", "", "EH*", t - 3, t + 15,
                               metadata=False)
     self.assertEqual(len(st), 3)
     self.assertNotIn('paz', st[0].stats)
     self.assertNotIn('coordinates', st[0].stats)
     # 2
     st = client.get_waveforms("BW", "MANZ", "", "EH*", t - 3, t + 15,
                               metadata=True)
     self.assertEqual(len(st), 3)
     self.assertIn('paz', st[0].stats)
     self.assertIn('coordinates', st[0].stats)
开发者ID:Brtle,项目名称:obspy,代码行数:20,代码来源:test_client.py

示例8: test_get_waveform_with_dcid_key_file

# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_waveforms [as 别名]
 def test_get_waveform_with_dcid_key_file(self):
     """
     Tests various DCID key file formats (with space or equal sign). Also
     checks if empty lines or comment lines are ignored.
     """
     # 1 - using = sign between username and password
     with NamedTemporaryFile() as tf:
         dcidfile = tf.name
         with open(dcidfile, 'wt') as fh:
             fh.write('#Comment\n\n\nTEST=XYZ\r\nBIA=OfH9ekhi\r\n')
         # test server for encryption
         client1 = Client(host="webdc.eu", port=36000,
                          user="[email protected]", dcid_key_file=dcidfile)
         # public server
         client2 = Client(host="webdc.eu", port=18001,
                          user="[email protected]")
     # request data
     start = UTCDateTime(2010, 1, 1, 10, 0, 0)
     end = start + 100
     stream1 = client1.get_waveforms('GE', 'APE', '', 'BHZ', start, end)
     stream2 = client2.get_waveforms('GE', 'APE', '', 'BHZ', start, end)
     # compare results
     np.testing.assert_array_equal(stream1[0].data, stream2[0].data)
     self.assertEqual(stream1[0].stats, stream2[0].stats)
     # 2 - using space between username and password
     with NamedTemporaryFile() as tf:
         dcidfile = tf.name
         with open(dcidfile, 'wt') as fh:
             fh.write('TEST XYZ\r\nBIA OfH9ekhi\r\n')
         # test server for encryption
         client1 = Client(host="webdc.eu", port=36000,
                          user="[email protected]", dcid_key_file=dcidfile)
         # public server
         client2 = Client(host="webdc.eu", port=18001,
                          user="[email protected]")
     # request data
     start = UTCDateTime(2010, 1, 1, 10, 0, 0)
     end = start + 100
     stream1 = client1.get_waveforms('GE', 'APE', '', 'BHZ', start, end)
     stream2 = client2.get_waveforms('GE', 'APE', '', 'BHZ', start, end)
     # compare results
     np.testing.assert_array_equal(stream1[0].data, stream2[0].data)
     self.assertEqual(stream1[0].stats, stream2[0].stats)
开发者ID:Abushalaa,项目名称:obspy,代码行数:45,代码来源:test_decrypt.py

示例9: test_get_waveform_with_default_dcid_key_file

# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_waveforms [as 别名]
 def test_get_waveform_with_default_dcid_key_file(self):
     """
     Use $HOME/dcidpasswords.txt.
     """
     dcidfile = DCID_KEY_FILE
     fh = open(dcidfile, 'wt')
     fh.write('TEST=XYZ\r\nBIA=OfH9ekhi\r\n')
     fh.close()
     # test server for encryption
     client1 = Client(host="webdc.eu", port=36000, user="[email protected]")
     # public server
     client2 = Client(host="webdc.eu", port=18001, user="[email protected]")
     # clean up dcid file
     os.remove(dcidfile)
     # request data
     start = UTCDateTime(2010, 1, 1, 10, 0, 0)
     end = start + 100
     stream1 = client1.get_waveforms('GE', 'APE', '', 'BHZ', start, end)
     stream2 = client2.get_waveforms('GE', 'APE', '', 'BHZ', start, end)
     # compare results
     np.testing.assert_array_equal(stream1[0].data, stream2[0].data)
     self.assertEqual(stream1[0].stats, stream2[0].stats)
开发者ID:Abushalaa,项目名称:obspy,代码行数:24,代码来源:test_decrypt.py

示例10: test_getWaveformNoCompression

# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_waveforms [as 别名]
 def test_getWaveformNoCompression(self):
     """
     Disabling compression during waveform request.
     """
     # initialize client
     client = Client(user="[email protected]")
     start = UTCDateTime(2011, 1, 1, 0, 0)
     end = start + 10
     stream = client.get_waveforms("BW", "MANZ", "", "EH*", start, end, compressed=False)
     self.assertEqual(len(stream), 3)
     for trace in stream:
         self.assertEqual(trace.stats.network, "BW")
         self.assertEqual(trace.stats.station, "MANZ")
开发者ID:yyuzhong,项目名称:obspy,代码行数:15,代码来源:test_client.py

示例11: test_delayedRequest

# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_waveforms [as 别名]
 def test_delayedRequest(self):
     """
     """
     # initialize client with 0.1 delay
     client = Client(host="webdc.eu", port=18002, command_delay=0.1, user="[email protected]")
     start = UTCDateTime(2010, 1, 1)
     end = start + 100
     # get_waveforms with 0.1 delay
     stream = client.get_waveforms("GR", "FUR", "", "HHE", start, end)
     self.assertEqual(len(stream), 1)
     # get_routing with 0.1 delay
     results = client.get_routing("GR", "FUR", start, end)
     self.assertIn("GR...", results)
开发者ID:yyuzhong,项目名称:obspy,代码行数:15,代码来源:test_client.py

示例12: test_issue372

# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_waveforms [as 别名]
 def test_issue372(self):
     """
     Test case for issue #372.
     """
     dt = UTCDateTime("20120729070000")
     client = Client(user="[email protected]")
     st = client.get_waveforms("BS", "JMB", "", "BH*", dt, dt + 7200, metadata=True)
     for tr in st:
         self.assertIn("paz", tr.stats)
         self.assertIn("coordinates", tr.stats)
         self.assertIn("poles", tr.stats.paz)
         self.assertIn("zeros", tr.stats.paz)
         self.assertIn("latitude", tr.stats.coordinates)
开发者ID:yyuzhong,项目名称:obspy,代码行数:15,代码来源:test_client.py

示例13: test_get_waveform_no_compression

# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_waveforms [as 别名]
 def test_get_waveform_no_compression(self):
     """
     Disabling compression during waveform request.
     """
     # initialize client
     client = Client(user='[email protected]')
     start = UTCDateTime(2011, 1, 1, 0, 0)
     end = start + 10
     stream = client.get_waveforms('BW', 'MANZ', '', 'EH*', start, end,
                                   compressed=False)
     self.assertEqual(len(stream), 3)
     for trace in stream:
         self.assertEqual(trace.stats.network, 'BW')
         self.assertEqual(trace.stats.station, 'MANZ')
开发者ID:Brtle,项目名称:obspy,代码行数:16,代码来源:test_client.py

示例14: test_delayed_request

# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_waveforms [as 别名]
 def test_delayed_request(self):
     """
     """
     # initialize client with 0.1 delay
     client = Client(host='webdc.eu', port=18002, command_delay=0.1,
                     user='[email protected]')
     start = UTCDateTime(2010, 1, 1)
     end = start + 100
     # get_waveforms with 0.1 delay
     stream = client.get_waveforms('GR', 'FUR', '', 'HHE', start, end)
     self.assertEqual(len(stream), 1)
     # get_routing with 0.1 delay
     results = client.get_routing('GR', 'FUR', start, end)
     self.assertIn('GR...', results)
开发者ID:Brtle,项目名称:obspy,代码行数:16,代码来源:test_client.py

示例15: test_getWaveformNoRouting

# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_waveforms [as 别名]
 def test_getWaveformNoRouting(self):
     """
     Tests routing parameter of get_waveforms method.
     """
     # 1 - requesting BW data w/o routing on webdc.eu
     client = Client(user="[email protected]")
     start = UTCDateTime(2008, 1, 1)
     end = start + 1
     self.assertRaises(ArcLinkException, client.get_waveforms, "BW", "MANZ", "", "EH*", start, end, route=False)
     # 2 - requesting BW data w/o routing directly from BW ArcLink node
     client = Client(host="erde.geophysik.uni-muenchen.de", port=18001, user="[email protected]")
     start = UTCDateTime(2008, 1, 1)
     end = start + 1
     stream = client.get_waveforms("BW", "MANZ", "", "EH*", start, end, route=False)
     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")
开发者ID:yyuzhong,项目名称:obspy,代码行数:23,代码来源:test_client.py


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