def test_read101Traces(self): """ Testing reading Q file with more than 100 traces. """ testfile = os.path.join(self.path, 'data', '101.QHD') # read stream = readQ(testfile) stream.verify() self.assertEqual(len(stream), 101)
def test_readAndWriteMultiChannelQFile(self): """ Read and write Q file via obspy.sh.core.readQ. """ #1 - little endian (PC) origfile = os.path.join(self.path, 'data', 'QFILE-TEST.QHD') # read original stream1 = readQ(origfile) stream1.verify() self._compareStream(stream1) # write tempfile = NamedTemporaryFile(suffix='.QHD').name writeQ(stream1, tempfile, append=False) # read again stream2 = readQ(tempfile) stream2.verify() self._compareStream(stream2) # remove binary file too (dynamically created) os.remove(os.path.splitext(tempfile)[0] + '.QBN') os.remove(tempfile) #2 - big endian (SUN) origfile = os.path.join(self.path, 'data', 'QFILE-TEST-SUN.QHD') # read original stream1 = readQ(origfile, byteorder=">") stream1.verify() self._compareStream(stream1) # write tempfile = NamedTemporaryFile(suffix='.QHD').name writeQ(stream1, tempfile, byteorder=">", append=False) # read again stream2 = readQ(tempfile, byteorder=">") stream2.verify() self._compareStream(stream2) # remove binary file too (dynamically created) os.remove(os.path.splitext(tempfile)[0] + '.QBN') os.remove(tempfile)
def test_readAndWriteMultiChannelQFile(self): """ Read and write Q file via obspy.sh.core.readQ. """ # 1 - little endian (PC) origfile = os.path.join(self.path, 'data', 'QFILE-TEST.QHD') # read original stream1 = readQ(origfile) stream1.verify() self._compareStream(stream1) # write with NamedTemporaryFile(suffix='.QHD') as tf: tempfile = tf.name writeQ(stream1, tempfile, append=False) # read again stream2 = readQ(tempfile) stream2.verify() self._compareStream(stream2) # remove binary file too (dynamically created) os.remove(os.path.splitext(tempfile)[0] + '.QBN') # 2 - big endian (SUN) origfile = os.path.join(self.path, 'data', 'QFILE-TEST-SUN.QHD') # read original stream1 = readQ(origfile, byteorder=">") stream1.verify() self._compareStream(stream1) # write with NamedTemporaryFile(suffix='.QHD') as tf: tempfile = tf.name writeQ(stream1, tempfile, byteorder=">", append=False) # read again stream2 = readQ(tempfile, byteorder=">") stream2.verify() self._compareStream(stream2) # remove binary file too (dynamically created) os.remove(os.path.splitext(tempfile)[0] + '.QBN')