コード例 #1
0
ファイル: test_network.py プロジェクト: FMassin/obspy
 def test_get_coordinates(self):
     """
     Test extracting coordinates
     """
     expected = {u'latitude': 47.737166999999999,
                 u'longitude': 12.795714,
                 u'elevation': 860.0,
                 u'local_depth': 0.0}
     channels = [Channel(code='EHZ',
                         location_code='',
                         start_date=UTCDateTime('2007-01-01'),
                         latitude=47.737166999999999,
                         longitude=12.795714,
                         elevation=860.0,
                         depth=0.0)]
     stations = [Station(code='RJOB',
                         latitude=0.0,
                         longitude=0.0,
                         elevation=0.0,
                         channels=channels)]
     network = Network('BW', stations=stations)
     # 1
     coordinates = network.get_coordinates('BW.RJOB..EHZ',
                                           UTCDateTime('2010-01-01T12:00'))
     self.assertEqual(sorted(coordinates.items()), sorted(expected.items()))
     # 2 - without datetime
     coordinates = network.get_coordinates('BW.RJOB..EHZ')
     self.assertEqual(sorted(coordinates.items()), sorted(expected.items()))
     # 3 - unknown SEED ID should raise exception
     self.assertRaises(Exception, network.get_coordinates, 'BW.RJOB..XXX')
コード例 #2
0
 def test_get_coordinates(self):
     """
     Test extracting coordinates
     """
     expected = {u'latitude': 47.737166999999999,
                 u'longitude': 12.795714,
                 u'elevation': 860.0,
                 u'local_depth': 0.0}
     channels = [Channel(code='EHZ',
                         location_code='',
                         start_date=UTCDateTime('2007-01-01'),
                         latitude=47.737166999999999,
                         longitude=12.795714,
                         elevation=860.0,
                         depth=0.0)]
     stations = [Station(code='RJOB',
                         latitude=0.0,
                         longitude=0.0,
                         elevation=0.0,
                         channels=channels)]
     network = Network('BW', stations=stations)
     # 1
     coordinates = network.get_coordinates('BW.RJOB..EHZ',
                                           UTCDateTime('2010-01-01T12:00'))
     assert sorted(coordinates.items()) == sorted(expected.items())
     # 2 - without datetime
     coordinates = network.get_coordinates('BW.RJOB..EHZ')
     assert sorted(coordinates.items()) == sorted(expected.items())
     # 3 - unknown SEED ID should raise exception
     with pytest.raises(Exception):
         network.get_coordinates('BW.RJOB..XXX')