本文整理汇总了Python中obspy.core.Stream.verify方法的典型用法代码示例。如果您正苦于以下问题:Python Stream.verify方法的具体用法?Python Stream.verify怎么用?Python Stream.verify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类obspy.core.Stream
的用法示例。
在下文中一共展示了Stream.verify方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_mergePreviews2
# 需要导入模块: from obspy.core import Stream [as 别名]
# 或者: from obspy.core.Stream import verify [as 别名]
def test_mergePreviews2(self):
"""
Test case for issue #84.
"""
# Note: explicitly creating np.ones instead of np.empty in order to
# prevent NumPy warnings related to max function
tr1 = Trace(data=np.ones(2880))
tr1.stats.starttime = UTCDateTime("2010-01-01T00:00:00.670000Z")
tr1.stats.delta = 30.0
tr1.stats.preview = True
tr1.verify()
tr2 = Trace(data=np.ones(2881))
tr2.stats.starttime = UTCDateTime("2010-01-01T23:59:30.670000Z")
tr2.stats.delta = 30.0
tr2.stats.preview = True
tr2.verify()
st1 = Stream([tr1, tr2])
st1.verify()
# merge
st2 = mergePreviews(st1)
st2.verify()
# check
self.assertTrue(st2[0].stats.preview)
self.assertEqual(st2[0].stats.starttime, tr1.stats.starttime)
self.assertEqual(st2[0].stats.endtime, tr2.stats.endtime)
self.assertEqual(st2[0].stats.npts, 5760)
self.assertEqual(len(st2[0]), 5760)
示例2: test_writeAndReadDifferentEncodings
# 需要导入模块: from obspy.core import Stream [as 别名]
# 或者: from obspy.core.Stream import verify [as 别名]
def test_writeAndReadDifferentEncodings(self):
"""
Writes and read a file with different encoding via the obspy.core
methods.
"""
npts = 1000
np.random.seed(815) # make test reproducable
data = np.random.randn(npts).astype('float64') * 1e3 + .5
st = Stream([Trace(data=data)])
# Loop over some record lengths.
for encoding, value in ENCODINGS.iteritems():
seed_dtype = value[2]
tempfile = NamedTemporaryFile().name
# Write it once with the encoding key and once with the value.
st[0].data = data.astype(seed_dtype)
st.verify()
st.write(tempfile, format="MSEED", encoding=encoding)
st2 = read(tempfile)
del st2[0].stats.mseed
np.testing.assert_array_equal(st[0].data, st2[0].data)
del st2
ms = _MSStruct(tempfile)
ms.read(-1, 1, 1, 0)
self.assertEqual(ms.msr.contents.encoding, encoding)
del ms # for valgrind
os.remove(tempfile)
示例3: test_writeIntegersViaObsPy
# 需要导入模块: from obspy.core import Stream [as 别名]
# 或者: from obspy.core.Stream import verify [as 别名]
def test_writeIntegersViaObsPy(self):
"""
Write file test via L{obspy.Trace}.
"""
tempfile = NamedTemporaryFile().name
npts = 1000
# data cloud of integers - float won't work!
np.random.seed(815) # make test reproducable
data = np.random.randint(-1000, 1000, npts).astype('int32')
stats = {'network': 'BW', 'station': 'TEST', 'location': '',
'channel': 'EHE', 'npts': npts, 'sampling_rate': 200.0}
start = UTCDateTime(2000, 1, 1)
stats['starttime'] = start
tr = Trace(data=data, header=stats)
st = Stream([tr])
st.verify()
# write
st.write(tempfile, format="GSE2")
# read again
stream = read(tempfile)
os.remove(tempfile)
stream.verify()
np.testing.assert_equal(data, stream[0].data)
# test default attributes
self.assertEqual('CM6', stream[0].stats.gse2.datatype)
self.assertEqual(-1, stream[0].stats.gse2.vang)
self.assertEqual(1.0, stream[0].stats.gse2.calper)
self.assertEqual(1.0, stream[0].stats.calib)