Commit 88f7f81e authored by Javier Quinteros's avatar Javier Quinteros

Add miniseed headers check in tests

parent 609be946
......@@ -151,8 +151,17 @@ class ConversionTests(unittest.TestCase):
aux = Trace(data=data[0], header=data[1])
conv = Stream([aux])
# Check the data
self.assertTrue(np.array_equal(orig[0].data, conv[0].data), 'Wrong comparison for one record and one channel!')
# self.assertEqual(orig[0].stats, conv[0].stats, 'Wrong comparison for one record and one channel!')
# Check the first level attributes
for item in conv[0].stats:
if item != 'mseed':
self.assertEqual(orig[0].stats[item], conv[0].stats[item])
# check the attributes within 'mseed'
for item in conv[0].stats['mseed']:
self.assertEqual(orig[0].stats['mseed'][item], conv[0].stats['mseed'][item])
def testOneChannel2(self):
"""One record from one channel defined by list of channels"""
......@@ -195,8 +204,17 @@ class ConversionTests(unittest.TestCase):
# Merge all Traces with same NSLC code
conv.merge()
# Check the data
self.assertTrue(np.array_equal(orig[0].data, conv[0].data), 'Wrong comparison for channel 99!')
# self.assertEqual(orig[0].stats, conv[0].stats, 'Wrong comparison for one record and one channel!')
# Check the first level attributes
for item in conv[0].stats:
if item != 'mseed':
self.assertEqual(orig[0].stats[item], conv[0].stats[item])
# check the attributes within 'mseed'
for item in conv[0].stats['mseed']:
self.assertEqual(orig[0].stats['mseed'][item], conv[0].stats['mseed'][item])
def testTwoChannels(self):
"""One record from two channels"""
......@@ -217,9 +235,20 @@ class ConversionTests(unittest.TestCase):
conv += aux
# TODO Improve error message replacing the number for the ID in Trace.stats
# Check the data
self.assertTrue(np.array_equal(orig[0].data, conv[0].data), 'Wrong comparison for channel 100!')
self.assertTrue(np.array_equal(orig[1].data, conv[1].data), 'Wrong comparison for channel 101!')
# self.assertEqual(orig[0].stats, conv[0].stats, 'Wrong comparison for one record and one channel!')
# Check the first level attributes
for item in conv[0].stats:
if item != 'mseed':
self.assertEqual(orig[0].stats[item], conv[0].stats[item])
self.assertEqual(orig[1].stats[item], conv[1].stats[item])
# check the attributes within 'mseed'
for item in conv[0].stats['mseed']:
self.assertEqual(orig[0].stats['mseed'][item], conv[0].stats['mseed'][item])
self.assertEqual(orig[1].stats['mseed'][item], conv[1].stats['mseed'][item])
def testTwoChannels2(self):
"""One record from two channels defined by list of channels"""
......@@ -239,9 +268,20 @@ class ConversionTests(unittest.TestCase):
aux = Trace(data=data[0], header=data[1])
conv += aux
# Check the data
self.assertTrue(np.array_equal(orig[0].data, conv[0].data), 'Wrong comparison for channel 100!')
self.assertTrue(np.array_equal(orig[1].data, conv[1].data), 'Wrong comparison for channel 101!')
# self.assertEqual(orig[0].stats, conv[0].stats, 'Wrong comparison for one record and one channel!')
# Check the first level attributes
for item in conv[0].stats:
if item != 'mseed':
self.assertEqual(orig[0].stats[item], conv[0].stats[item])
self.assertEqual(orig[1].stats[item], conv[1].stats[item])
# check the attributes within 'mseed'
for item in conv[0].stats['mseed']:
self.assertEqual(orig[0].stats['mseed'][item], conv[0].stats['mseed'][item])
self.assertEqual(orig[1].stats['mseed'][item], conv[1].stats['mseed'][item])
def testTwoRecords(self):
"""Two records from one channel"""
......@@ -264,5 +304,14 @@ class ConversionTests(unittest.TestCase):
# Merge all Traces with same NSLC code
conv.merge()
# Check the data
self.assertTrue(np.array_equal(orig[0].data, conv[0].data), 'Wrong comparison for channel 100!')
# self.assertEqual(orig[0].stats, conv[0].stats, 'Wrong comparison for one record and one channel!')
# Check the first level attributes
for item in conv[0].stats:
if item != 'mseed':
self.assertEqual(orig[0].stats[item], conv[0].stats[item])
# check the attributes within 'mseed'
for item in conv[0].stats['mseed']:
self.assertEqual(orig[0].stats['mseed'][item], conv[0].stats['mseed'][item])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment