Beispiel #1
0
 def test_swapbytes(self):
     tfilel = os.path.join(os.path.dirname(__file__), 'data', 'test.sac')
     tfileb = os.path.join(os.path.dirname(__file__), 'data',
                           'test.sac.swap')
     with NamedTemporaryFile() as tf:
         tempfile = tf.name
         tb = SacIO(tfileb)
         tb.swap_byte_order()
         tb.WriteSacBinary(tempfile)
         t = SacIO(tempfile)
         tl = SacIO(tfilel)
         self.assertEqual(t.GetHvalue('kevnm'), tl.GetHvalue('kevnm'))
         self.assertEqual(t.GetHvalue('npts'), tl.GetHvalue('npts'))
         self.assertEqual(t.GetHvalue('delta'), tl.GetHvalue('delta'))
         np.testing.assert_array_equal(t.seis, tl.seis)
     with NamedTemporaryFile() as tf:
         tempfile = tf.name
         tl = SacIO(tfilel)
         tl.swap_byte_order()
         tl.WriteSacBinary(tempfile)
         t = SacIO(tempfile)
         tb = SacIO(tfileb)
         self.assertEqual(t.GetHvalue('kevnm'), tb.GetHvalue('kevnm'))
         self.assertEqual(t.GetHvalue('npts'), tb.GetHvalue('npts'))
         self.assertEqual(t.GetHvalue('delta'), tb.GetHvalue('delta'))
         np.testing.assert_array_equal(t.seis, tb.seis)
Beispiel #2
0
 def test_swapbytes(self):
     tfilel = os.path.join(os.path.dirname(__file__), 'data', 'test.sac')
     tfileb = os.path.join(os.path.dirname(__file__), 'data',
                           'test.sac.swap')
     with NamedTemporaryFile() as tf:
         tempfile = tf.name
         tb = SacIO(tfileb)
         tb.swap_byte_order()
         tb.WriteSacBinary(tempfile)
         t = SacIO(tempfile)
         tl = SacIO(tfilel)
         self.assertEqual(t.GetHvalue('kevnm'), tl.GetHvalue('kevnm'))
         self.assertEqual(t.GetHvalue('npts'), tl.GetHvalue('npts'))
         self.assertEqual(t.GetHvalue('delta'), tl.GetHvalue('delta'))
         np.testing.assert_array_equal(t.seis, tl.seis)
     with NamedTemporaryFile() as tf:
         tempfile = tf.name
         tl = SacIO(tfilel)
         tl.swap_byte_order()
         tl.WriteSacBinary(tempfile)
         t = SacIO(tempfile)
         tb = SacIO(tfileb)
         self.assertEqual(t.GetHvalue('kevnm'), tb.GetHvalue('kevnm'))
         self.assertEqual(t.GetHvalue('npts'), tb.GetHvalue('npts'))
         self.assertEqual(t.GetHvalue('delta'), tb.GetHvalue('delta'))
         np.testing.assert_array_equal(t.seis, tb.seis)
Beispiel #3
0
 def test_swapbytes(self):
     tfilel = os.path.join(os.path.dirname(__file__), "data", "test.sac")
     tfileb = os.path.join(os.path.dirname(__file__), "data", "test.sac.swap")
     with NamedTemporaryFile() as tf:
         tempfile = tf.name
         tb = SacIO(tfileb)
         tb.swap_byte_order()
         tb.WriteSacBinary(tempfile)
         tr1 = SacIO(tempfile)
         tl = SacIO(tfilel)
         np.testing.assert_array_equal(tl.seis, tr1.seis)
         self.assertEqual(tl.GetHvalue("kevnm"), tr1.GetHvalue("kevnm"))
         self.assertEqual(tl.GetHvalue("npts"), tr1.GetHvalue("npts"))
         self.assertEqual(tl.GetHvalueFromFile(tfilel, "kcmpnm"), tr1.GetHvalueFromFile(tempfile, "kcmpnm"))
Beispiel #4
0
 def test_swapbytes(self):
     tfilel = os.path.join(os.path.dirname(__file__), 'data', 'test.sac')
     tfileb = os.path.join(os.path.dirname(__file__), 'data',
                           'test.sac.swap')
     tempfile = NamedTemporaryFile().name
     tb = SacIO(tfileb)
     tb.swap_byte_order()
     tb.WriteSacBinary(tempfile)
     tr1 = SacIO(tempfile)
     tl = SacIO(tfilel)
     np.testing.assert_array_equal(tl.seis, tr1.seis)
     self.assertEqual(tl.GetHvalue('kevnm'), tr1.GetHvalue('kevnm'))
     self.assertEqual(tl.GetHvalue('npts'), tr1.GetHvalue('npts'))
     self.assertEqual(tl.GetHvalueFromFile(tfilel, 'kcmpnm'),
                      tr1.GetHvalueFromFile(tempfile, 'kcmpnm'))
     os.remove(tempfile)
Beispiel #5
0
 def test_swapbytes(self):
     tfilel = os.path.join(os.path.dirname(__file__), 'data', 'test.sac')
     tfileb = os.path.join(os.path.dirname(__file__), 'data',
                           'test.sac.swap')
     tempfile = NamedTemporaryFile().name
     tb = SacIO(tfileb)
     tb.swap_byte_order()
     tb.WriteSacBinary(tempfile)
     tr1 = SacIO(tempfile)
     tl = SacIO(tfilel)
     np.testing.assert_array_equal(tl.seis, tr1.seis)
     self.assertEqual(tl.GetHvalue('kevnm'), tr1.GetHvalue('kevnm'))
     self.assertEqual(tl.GetHvalue('npts'), tr1.GetHvalue('npts'))
     self.assertEqual(tl.GetHvalueFromFile(tfilel, 'kcmpnm'),
                      tr1.GetHvalueFromFile(tempfile, 'kcmpnm'))
     os.remove(tempfile)