Coverage for /opt/obspy/update-docs/src/obspy/obspy/neries/tests/test_client : 86%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*- The obspy.neries.client test suite. """
""" Test cases for obspy.neries.client.Client. """ """ Testing event request method. """ # 1 max_datetime="2005-01-01") 'origin_id': 1347097, 'longitude': 57.143, 'datetime': UTCDateTime('2004-03-12T22:48:05Z'), 'depth':-700.0, 'magnitude': 4.4, 'magnitude_type': u'mb', 'latitude': 26.303, 'flynn_region': u'SOUTHERN IRAN'}] # 2 max_latitude=-1, min_longitude=20, max_longitude=90, max_datetime="2005-01-01") 'origin_id': 120690, 'longitude': 33.682, 'datetime': UTCDateTime('2004-10-16T01:29:14Z'), 'depth':-10.0, 'magnitude': 5.0, 'magnitude_type': u'm ', 'latitude':-46.394, 'flynn_region': u'PRINCE EDWARD ISLANDS REGION'}] # 3 max_depth=-22.33, min_magnitude=6.6, max_magnitude=7, max_datetime="2005-01-01") 'origin_id': 1441886, 'longitude': 54.843, 'datetime': UTCDateTime('2000-12-06T17:11:05Z'), 'depth':-11.4, 'magnitude': 6.7, 'magnitude_type': u'mb', 'latitude': 39.604}, {'author': u'EMSC', 'event_id': u'20010210_0000010', 'origin_id': 1438991, 'longitude': 43.784, 'datetime': UTCDateTime('2001-02-10T18:21:57Z'), 'depth':-17.0, 'magnitude': 6.6, 'magnitude_type': u'mb', 'latitude': 12.045, 'flynn_region': u'NEAR THE COAST OF YEMEN'}] # 4 magnitude_type="mw", min_magnitude=4, max_datetime="2005-01-01") 'origin_id': 1500183, 'longitude': 20.816, 'datetime': UTCDateTime('1998-01-10T19:21:55Z'), 'depth':-10.0, 'magnitude': 5.5, 'magnitude_type': u'mw', 'latitude': 37.243, 'flynn_region': u'IONIAN SEA'}, {'author': u'EMSC', 'event_id': u'19980128_0000006', 'origin_id': 1500249, 'longitude': 32.204, 'datetime': UTCDateTime('1998-01-28T22:38:57Z'), 'depth':-41.6, 'magnitude': 4.3, 'magnitude_type': u'mw', 'latitude': 34.429}, {'author': u'EMSC', 'event_id': u'19980213_0000004', 'origin_id': 1500135, 'longitude': 28.459, 'datetime': UTCDateTime('1998-02-13T07:18:50Z'), 'depth':-69.2, 'magnitude': 4.8, 'magnitude_type': u'mw', 'latitude': 36.284}]
""" Testing event request method with UTCDateTimes as input parameters. """ # 1 max_datetime=UTCDateTime("2005-01-01")) 'origin_id': 1347097, 'longitude': 57.143, 'datetime': UTCDateTime('2004-03-12T22:48:05Z'), 'depth':-700.0, 'magnitude': 4.4, 'magnitude_type': u'mb', 'latitude': 26.303, 'flynn_region': u'SOUTHERN IRAN'}] # 2 min_datetime=UTCDateTime("2004-01-01"), max_datetime=UTCDateTime("2005-01-01")) 'origin_id': 1347097, 'longitude': 57.143, 'datetime': UTCDateTime('2004-03-12T22:48:05Z'), 'depth':-700.0, 'magnitude': 4.4, 'magnitude_type': u'mb', 'latitude': 26.303, 'flynn_region': u'SOUTHERN IRAN'}]
""" Testing event request with QuakeML as output format. """ max_datetime=UTCDateTime("2005-01-01")) # check for origin id
""" Testing event request with Catalog as output format. """ max_datetime=UTCDateTime("2005-01-01")) # check for origin id
""" Testing event detail request method. """ # EMSC identifier # xml # list # catalog # QuakeML identifier # xml format='xml') # list format='list') # catalog format='catalog')
""" Testing request method for latest events. """ # xml # list # catalog # no given number of events should default to 10 # invalid number of events should default to 10
""" Testing request method for calculating travel times. """ # 1 # 2 [(120, 0), (150, 0), (180, 0)])
""" """ # initialize client # MiniSEED st = read(mseedfile) # MiniSEED may not start with Volume Index Control Headers (V) self.assertNotEquals(open(mseedfile).read(8)[6], "V") # ArcLink cuts on record base self.assertTrue(st[0].stats.starttime <= start) self.assertTrue(st[0].stats.endtime >= end) self.assertEquals(st[0].stats.network, 'BW') self.assertEquals(st[0].stats.station, 'MANZ') self.assertEquals(st[0].stats.location, '') self.assertEquals(st[0].stats.channel, 'EHZ') os.remove(mseedfile) # Full SEED client.saveWaveform(fseedfile, 'BW', 'MANZ', '', 'EHZ', start, end, format='FSEED') st = read(fseedfile) # Full SEED must start with Volume Index Control Headers (V) self.assertEquals(open(fseedfile).read(8)[6], "V") # ArcLink cuts on record base self.assertTrue(st[0].stats.starttime <= start) self.assertTrue(st[0].stats.endtime >= end) self.assertEquals(st[0].stats.network, 'BW') self.assertEquals(st[0].stats.station, 'MANZ') self.assertEquals(st[0].stats.location, '') self.assertEquals(st[0].stats.channel, 'EHZ') os.remove(fseedfile)
""" Testing inventory requests. """ # 1 - XML w/ instruments format='XML') # 2 - SUDS object w/o instruments instruments=False) # 3 - SUDS object w/ instruments instruments=True) # 4 - SUDS object with spatial filters min_latitude=-72.0, max_latitude=-71.0, min_longitude=-3, max_longitude=-2) # 5 - SUDS object with spatial filters with incorrect coordinates min_latitude=-71.0, max_latitude=-72.0, min_longitude=-2, max_longitude=-3)
if __name__ == '__main__': unittest.main(defaultTest='suite') |