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


Python Client.save_waveforms方法代码示例

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


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

示例1: test_saveWaveformCompressed

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

示例2: test_save_waveform_compressed

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

示例3: test_save_waveform

# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import save_waveforms [as 别名]
 def test_save_waveform(self):
     """
     Default behavior is requesting data compressed and unpack on the fly.
     """
     # initialize client
     client = Client('[email protected]',
                     host="erde.geophysik.uni-muenchen.de", port=18001)
     start = UTCDateTime(2008, 1, 1)
     end = start + 10
     # MiniSEED
     with NamedTemporaryFile(suffix='.bz2') as tf:
         mseedfile = tf.name
         client.save_waveforms(mseedfile, 'BW', 'MANZ', '', 'EHZ', start,
                               end)
         st = read(mseedfile)
         # MiniSEED may not start with Volume Index Control Headers (V)
         with open(mseedfile, 'rb') as fp:
             self.assertNotEqual(fp.read(8)[6:7], b"V")
         # ArcLink cuts on record base
         self.assertLessEqual(st[0].stats.starttime, start)
         self.assertGreaterEqual(st[0].stats.endtime, end)
         self.assertEqual(st[0].stats.network, 'BW')
         self.assertEqual(st[0].stats.station, 'MANZ')
         self.assertEqual(st[0].stats.location, '')
         self.assertEqual(st[0].stats.channel, 'EHZ')
     # Full SEED
     with NamedTemporaryFile(suffix='.bz2') as tf:
         fseedfile = tf.name
         client.save_waveforms(fseedfile, 'BW', 'MANZ', '', 'EHZ', start,
                               end, format='FSEED')
         st = read(fseedfile)
         # Full SEED must start with Volume Index Control Headers (V)
         with open(fseedfile, 'rb') as fp:
             self.assertEqual(fp.read(8)[6:7], b"V")
         # ArcLink cuts on record base
         self.assertLessEqual(st[0].stats.starttime, start)
         self.assertGreaterEqual(st[0].stats.endtime, end)
         self.assertEqual(st[0].stats.network, 'BW')
         self.assertEqual(st[0].stats.station, 'MANZ')
         self.assertEqual(st[0].stats.location, '')
         self.assertEqual(st[0].stats.channel, 'EHZ')
开发者ID:Brtle,项目名称:obspy,代码行数:43,代码来源:test_client.py

示例4: test_saveWaveformNoCompression

# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import save_waveforms [as 别名]
 def test_saveWaveformNoCompression(self):
     """
     Explicitly disable compression during waveform request and save it
     directly to disk.
     """
     # initialize client
     client = Client(user="[email protected]")
     start = UTCDateTime(2010, 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, compressed=False)
         st = read(mseedfile)
         # MiniSEED may not start with Volume Index Control Headers (V)
         with open(mseedfile, "rb") as fp:
             self.assertNotEqual(fp.read(8)[6:7], b"V")
         # ArcLink cuts on record base
         self.assertEqual(st[0].stats.network, "GE")
         self.assertEqual(st[0].stats.station, "APE")
         self.assertEqual(st[0].stats.location, "")
         self.assertEqual(st[0].stats.channel, "BHZ")
     # Full SEED
     with NamedTemporaryFile(suffix=".bz2") as tf:
         fseedfile = tf.name
         client.save_waveforms(fseedfile, "GE", "APE", "", "BHZ", start, end, format="FSEED")
         st = read(fseedfile)
         # Full SEED
         client.save_waveforms(fseedfile, "BW", "MANZ", "", "EHZ", start, end, format="FSEED")
         # ArcLink cuts on record base
         self.assertEqual(st[0].stats.network, "GE")
         self.assertEqual(st[0].stats.station, "APE")
         self.assertEqual(st[0].stats.location, "")
         self.assertEqual(st[0].stats.channel, "BHZ")
开发者ID:yyuzhong,项目名称:obspy,代码行数:36,代码来源:test_client.py

示例5: test_save_waveform_no_compression

# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import save_waveforms [as 别名]
 def test_save_waveform_no_compression(self):
     """
     Explicitly disable compression during waveform request and save it
     directly to disk.
     """
     # initialize client
     client = Client(user='[email protected]')
     start = UTCDateTime(2010, 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, compressed=False)
         st = read(mseedfile)
         # MiniSEED may not start with Volume Index Control Headers (V)
         with open(mseedfile, 'rb') as fp:
             self.assertNotEqual(fp.read(8)[6:7], b"V")
         # ArcLink cuts on record base
         self.assertEqual(st[0].stats.network, 'GE')
         self.assertEqual(st[0].stats.station, 'APE')
         self.assertEqual(st[0].stats.location, '')
         self.assertEqual(st[0].stats.channel, 'BHZ')
     # Full SEED
     with NamedTemporaryFile(suffix='.bz2') as tf:
         fseedfile = tf.name
         client.save_waveforms(fseedfile, 'GE', 'APE', '', 'BHZ', start,
                               end, format='FSEED')
         st = read(fseedfile)
         # Full SEED
         client.save_waveforms(fseedfile, 'BW', 'MANZ', '', 'EHZ', start,
                               end, format='FSEED')
         # ArcLink cuts on record base
         self.assertEqual(st[0].stats.network, 'GE')
         self.assertEqual(st[0].stats.station, 'APE')
         self.assertEqual(st[0].stats.location, '')
         self.assertEqual(st[0].stats.channel, 'BHZ')
开发者ID:Brtle,项目名称:obspy,代码行数:39,代码来源:test_client.py


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