Пример #1
0
 def test_read_101_traces(self):
     """
     Testing reading Q file with more than 100 traces.
     """
     testfile = os.path.join(self.path, 'data', '101.QHD')
     # read
     stream = _read_q(testfile)
     stream.verify()
     self.assertEqual(len(stream), 101)
Пример #2
0
 def test_read101Traces(self):
     """
     Testing reading Q file with more than 100 traces.
     """
     testfile = os.path.join(self.path, 'data', '101.QHD')
     # read
     stream = _read_q(testfile)
     stream.verify()
     self.assertEqual(len(stream), 101)
Пример #3
0
 def test_read_and_write_multi_channel_q_file(self):
     """
     Read and write Q file via obspy.io.sh.core._read_q.
     """
     # 1 - little endian (PC)
     origfile = os.path.join(self.path, 'data', 'QFILE-TEST.QHD')
     # read original
     stream1 = _read_q(origfile)
     stream1.verify()
     self._compare_stream(stream1)
     # write
     with NamedTemporaryFile(suffix='.QHD') as tf:
         tempfile = tf.name
         _write_q(stream1, tempfile, append=False)
         # read again
         stream2 = _read_q(tempfile)
         stream2.verify()
         self._compare_stream(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 = _read_q(origfile, byteorder=">")
     stream1.verify()
     self._compare_stream(stream1)
     # write
     with NamedTemporaryFile(suffix='.QHD') as tf:
         tempfile = tf.name
         _write_q(stream1, tempfile, byteorder=">", append=False)
         # read again
         stream2 = _read_q(tempfile, byteorder=">")
         stream2.verify()
         self._compare_stream(stream2)
         # remove binary file too (dynamically created)
         os.remove(os.path.splitext(tempfile)[0] + '.QBN')
Пример #4
0
 def test_readAndWriteMultiChannelQFile(self):
     """
     Read and write Q file via obspy.io.sh.core._read_q.
     """
     # 1 - little endian (PC)
     origfile = os.path.join(self.path, 'data', 'QFILE-TEST.QHD')
     # read original
     stream1 = _read_q(origfile)
     stream1.verify()
     self._compareStream(stream1)
     # write
     with NamedTemporaryFile(suffix='.QHD') as tf:
         tempfile = tf.name
         _write_q(stream1, tempfile, append=False)
         # read again
         stream2 = _read_q(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 = _read_q(origfile, byteorder=">")
     stream1.verify()
     self._compareStream(stream1)
     # write
     with NamedTemporaryFile(suffix='.QHD') as tf:
         tempfile = tf.name
         _write_q(stream1, tempfile, byteorder=">", append=False)
         # read again
         stream2 = _read_q(tempfile, byteorder=">")
         stream2.verify()
         self._compareStream(stream2)
         # remove binary file too (dynamically created)
         os.remove(os.path.splitext(tempfile)[0] + '.QBN')