Example #1
0
 def test_getCoordinates(self):
     """
     Test extracting coordinates for SEED and XSEED (including #146)
     """
     # SEED
     sp = Parser(os.path.join(self.path, 'dataless.seed.BW_RJOB'))
     result = {'elevation': 860.0, 'latitude': 47.737166999999999,
               'longitude': 12.795714, 'local_depth': 0}
     paz = sp.getCoordinates("BW.RJOB..EHZ", UTCDateTime("2007-01-01"))
     self.assertEqual(sorted(paz.items()), sorted(result.items()))
     paz = sp.getCoordinates("BW.RJOB..EHZ", UTCDateTime("2010-01-01"))
     self.assertEqual(sorted(paz.items()), sorted(result.items()))
     # XSEED
     sp2 = Parser(sp.getXSEED())
     paz = sp2.getCoordinates("BW.RJOB..EHZ", UTCDateTime("2007-01-01"))
     self.assertEqual(sorted(paz.items()), sorted(result.items()))
     paz = sp2.getCoordinates("BW.RJOB..EHZ", UTCDateTime("2010-01-01"))
     self.assertEqual(sorted(paz.items()), sorted(result.items()))
Example #2
0
 def test_getCoordinates(self):
     """
     Test extracting coordinates for SEED and XSEED (including #146)
     """
     # SEED
     sp = Parser(os.path.join(self.path, 'dataless.seed.BW_RJOB'))
     result = {'elevation': 860.0, 'latitude': 47.737166999999999,
               'longitude': 12.795714, 'local_depth': 0}
     paz = sp.getCoordinates("BW.RJOB..EHZ", UTCDateTime("2007-01-01"))
     self.assertEqual(sorted(paz.items()), sorted(result.items()))
     paz = sp.getCoordinates("BW.RJOB..EHZ", UTCDateTime("2010-01-01"))
     self.assertEqual(sorted(paz.items()), sorted(result.items()))
     # XSEED
     sp2 = Parser(sp.getXSEED())
     paz = sp2.getCoordinates("BW.RJOB..EHZ", UTCDateTime("2007-01-01"))
     self.assertEqual(sorted(paz.items()), sorted(result.items()))
     paz = sp2.getCoordinates("BW.RJOB..EHZ", UTCDateTime("2010-01-01"))
     self.assertEqual(sorted(paz.items()), sorted(result.items()))
Example #3
0
 def test_issue157(self):
     """
     Test case for issue #157: re-using parser object.
     """
     expected = {'latitude': 48.162899, 'elevation': 565.0,
                 'longitude': 11.2752, 'local_depth': 0.0}
     filename1 = os.path.join(self.path, 'dataless.seed.BW_FURT')
     filename2 = os.path.join(self.path, 'dataless.seed.BW_MANZ')
     t = UTCDateTime("2010-07-01")
     parser = Parser()
     parser.read(filename2)
     # parsing a second time will raise a UserWarning: Clearing parser
     # before every subsequent read()
     with warnings.catch_warnings(record=True):
         warnings.simplefilter("error", UserWarning)
         self.assertRaises(UserWarning, parser.read, filename1)
         warnings.simplefilter("ignore", UserWarning)
         parser.read(filename1)
         result = parser.getCoordinates("BW.FURT..EHZ", t)
         self.assertEqual(expected, result)
Example #4
0
 def test_issue157(self):
     """
     Test case for issue #157: re-using parser object.
     """
     expected = {'latitude': 48.162899, 'elevation': 565.0,
                 'longitude': 11.2752, 'local_depth': 0.0}
     filename1 = os.path.join(self.path, 'dataless.seed.BW_FURT')
     filename2 = os.path.join(self.path, 'dataless.seed.BW_MANZ')
     t = UTCDateTime("2010-07-01")
     parser = Parser()
     parser.read(filename2)
     # parsing a second time will raise a UserWarning: Clearing parser
     # before every subsequent read()
     with warnings.catch_warnings(record=True):
         warnings.simplefilter("error", UserWarning)
         self.assertRaises(UserWarning, parser.read, filename1)
         warnings.simplefilter("ignore", UserWarning)
         parser.read(filename1)
         result = parser.getCoordinates("BW.FURT..EHZ", t)
         self.assertEqual(expected, result)