本文整理匯總了Python中obspy.neries.Client.getInventory方法的典型用法代碼示例。如果您正苦於以下問題:Python Client.getInventory方法的具體用法?Python Client.getInventory怎麽用?Python Client.getInventory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類obspy.neries.Client
的用法示例。
在下文中一共展示了Client.getInventory方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_getInventory
# 需要導入模塊: from obspy.neries import Client [as 別名]
# 或者: from obspy.neries.Client import getInventory [as 別名]
def test_getInventory(self):
"""
Testing inventory requests.
"""
client = Client(user='[email protected]')
dt1 = UTCDateTime("1974-01-01T00:00:00")
dt2 = UTCDateTime("2011-01-01T00:00:00")
# 1 - XML w/ instruments
result = client.getInventory('GE', 'SNAA', '', 'BHZ', dt1, dt2,
format='XML')
self.assertTrue(result.startswith('<?xml'))
self.assertTrue('code="GE"' in result)
# 2 - SUDS object w/o instruments
result = client.getInventory('GE', 'SNAA', '', 'BHZ', dt1, dt2,
instruments=False)
self.assertTrue(isinstance(result, object))
self.assertEqual(result.ArclinkInventory.inventory.network._code, 'GE')
# 3 - SUDS object w/ instruments
result = client.getInventory('GE', 'SNAA', '', 'BHZ', dt1, dt2,
instruments=True)
self.assertTrue(isinstance(result, object))
self.assertEqual(result.ArclinkInventory.inventory.network._code, 'GE')
self.assertTrue('sensor' in result.ArclinkInventory.inventory)
self.assertTrue('responsePAZ' in result.ArclinkInventory.inventory)
# 4 - SUDS object with spatial filters
client = Client(user='[email protected]')
result = client.getInventory('GE', 'SNAA', '', 'BHZ', dt1, dt2,
min_latitude=-72.0, max_latitude=-71.0,
min_longitude=-3, max_longitude=-2)
self.assertTrue(isinstance(result, object))
self.assertEqual(result.ArclinkInventory.inventory.network._code, 'GE')
# 5 - SUDS object with spatial filters with incorrect coordinates
client = Client(user='[email protected]')
result = client.getInventory('GE', 'SNAA', '', 'BHZ', dt1, dt2,
min_latitude=-71.0, max_latitude=-72.0,
min_longitude=-2, max_longitude=-3)
self.assertTrue(isinstance(result, object))
self.assertEqual(result.ArclinkInventory.inventory.network._code, 'GE')