本文整理汇总了Python中obspy.clients.arclink.Client.get_inventory方法的典型用法代码示例。如果您正苦于以下问题:Python Client.get_inventory方法的具体用法?Python Client.get_inventory怎么用?Python Client.get_inventory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类obspy.clients.arclink.Client
的用法示例。
在下文中一共展示了Client.get_inventory方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_inventory_stationgroup
# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_inventory [as 别名]
def test_get_inventory_stationgroup(self):
"""
Tests get_inventory method for StationGroup, issue #1756.
"""
client = Client(user='[email protected]')
# 1 - defined @INGV
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings("always")
result = client.get_inventory(network="_NFOTABOO", route=True)
self.assertEqual(len(w), 1)
self.assertEqual(
str(w[0].message),
"Routing was requested but parameter 'network' is '_NFOTABOO' "
"and therefore routing is disabled.")
self.assertIn('IV', result)
self.assertIn('IV.ATBU', result)
self.assertIn('IV.SSFR', result)
# 2 - defined @NIEP
result = client.get_inventory(network="_NFOVRANC", route=False)
self.assertIn('RO', result)
self.assertIn('RO.BISRR', result)
self.assertIn('RO.VRI', result)
# 3 - defined @ETH
result = client.get_inventory(
network="_NFOVALAIS", starttime=UTCDateTime(2017, 10, 16),
endtime=UTCDateTime(2017, 10, 19))
self.assertIn('CH', result)
self.assertIn('S', result)
# self.assertIn('7H', result) This network does not appear to be
# included in the _NFOVALAIS network anymore. Checked on 03/12/2018
# at http://eida.gfz-potsdam.de/webdc3/
self.assertIn('CH.AIGLE', result)
self.assertIn('CH.VANNI', result)
self.assertIn('S.ESION', result)
示例2: test_get_inventory_stationgroup
# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_inventory [as 别名]
def test_get_inventory_stationgroup(self):
"""
Tests get_inventory method for StationGroup, issue #1756.
"""
client = Client(user='[email protected]')
# 1 - defined @INGV
with warnings.catch_warnings(record=True) as w:
warnings.filterwarnings("always")
result = client.get_inventory(network="_NFOTABOO", route=True)
self.assertEqual(len(w), 1)
self.assertEqual(
str(w[0].message),
"Routing was requested but parameter 'network' is '_NFOTABOO' "
"and therefore routing is disabled.")
self.assertIn('IV', result)
self.assertIn('IV.ATBU', result)
self.assertIn('IV.SSFR', result)
# 2 - defined @NIEP
result = client.get_inventory(network="_NFOVRANC", route=False)
self.assertIn('RO', result)
self.assertIn('RO.BISRR', result)
self.assertIn('RO.VRI', result)
# 3 - defined @ETH
result = client.get_inventory(network="_NFOVALAIS")
self.assertIn('CH', result)
self.assertIn('S', result)
self.assertIn('7H', result)
self.assertIn('CH.AIGLE', result)
self.assertIn('CH.VANNI', result)
self.assertIn('S.ESION', result)
示例3: test_getInventoryTwice
# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_inventory [as 别名]
def test_getInventoryTwice(self):
"""
Requesting inventory data twice should not fail.
"""
client = Client(user="[email protected]")
dt = UTCDateTime(2009, 1, 1)
# station
client.get_inventory("BW", "MANZ", starttime=dt, endtime=dt + 1)
client.get_inventory("BW", "MANZ", starttime=dt, endtime=dt + 1)
# network
client.get_inventory("BW", starttime=dt, endtime=dt + 1)
client.get_inventory("BW", starttime=dt, endtime=dt + 1)
示例4: test_get_inventory_twice
# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_inventory [as 别名]
def test_get_inventory_twice(self):
"""
Requesting inventory data twice should not fail.
"""
client = Client(user='[email protected]')
dt = UTCDateTime(2009, 1, 1)
# station
client.get_inventory('BW', 'MANZ', starttime=dt, endtime=dt + 1)
client.get_inventory('BW', 'MANZ', starttime=dt, endtime=dt + 1)
# network
client.get_inventory('BW', starttime=dt, endtime=dt + 1)
client.get_inventory('BW', starttime=dt, endtime=dt + 1)
示例5: test_getInventoryInstrumentChange
# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_inventory [as 别名]
def test_getInventoryInstrumentChange(self):
"""
Check results of get_inventory if instrumentation has been changed.
Sensitivity change for GE.SNAA..BHZ at 2003-01-10T00:00:00
"""
client = Client(user="[email protected]")
# one instrument in given time span
dt = UTCDateTime("2003-01-09T00:00:00")
inv = client.get_inventory("GE", "SNAA", "", "BHZ", dt, dt + 10, instruments=True, route=False)
self.assertTrue(len(inv["GE.SNAA..BHZ"]), 1)
# two instruments in given time span
dt = UTCDateTime("2003-01-09T23:59:59")
inv = client.get_inventory("GE", "SNAA", "", "BHZ", dt, dt + 10, instruments=True, route=False)
self.assertTrue(len(inv["GE.SNAA..BHZ"]), 2)
# one instrument in given time span
dt = UTCDateTime("2003-01-10T00:00:00")
inv = client.get_inventory("GE", "SNAA", "", "BHZ", dt, dt + 10, instruments=True, route=False)
self.assertTrue(len(inv["GE.SNAA..BHZ"]), 1)
示例6: test_getInventory
# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_inventory [as 别名]
def test_getInventory(self):
"""
Tests get_inventory method on various ArcLink nodes.
"""
client = Client(user="[email protected]")
dt = UTCDateTime(2010, 1, 1)
# 1 - GE network
result = client.get_inventory("GE", "APE", starttime=dt, endtime=dt + 1)
self.assertIn("GE", result)
self.assertIn("GE.APE", result)
# 2 - GE network
result = client.get_inventory("GE", "APE", "", "BHE", starttime=dt, endtime=dt + 1, instruments=True)
self.assertIn("GE", result)
self.assertIn("GE.APE", result)
self.assertIn("GE.APE..BHE", result) # only for instruments=True
# 3 - BW network
result = client.get_inventory("BW", "RJOB", starttime=dt, endtime=dt + 1)
self.assertIn("BW", result)
self.assertIn("BW.RJOB", result)
# 4 - BW network
result = client.get_inventory("BW", "MANZ", "", "EHE", starttime=dt, endtime=dt + 1, instruments=True)
self.assertIn("BW", result)
self.assertIn("BW.MANZ", result)
self.assertIn("BW.MANZ..EHE", result)
# 5 - unknown network 00 via webdc.eu:18002
self.assertRaises(ArcLinkException, client.get_inventory, "00", "", starttime=dt, endtime=dt + 1)
# 6 - get channel gain without PAZ
start = UTCDateTime("1970-01-01 00:00:00")
end = UTCDateTime("2020-10-19 00:00:00")
result = client.get_inventory("BW", "MANZ", "", "EHE", start, end)
self.assertIn("BW", result)
self.assertIn("BW.MANZ", result)
self.assertIn("BW.MANZ..EHE", result)
self.assertEqual(len(result["BW.MANZ..EHE"]), 2)
self.assertIn("gain", result["BW.MANZ..EHE"][0])
self.assertNotIn("paz", result["BW.MANZ..EHE"][0])
# 7 - history of instruments
# GE.SNAA sometimes needs a while therefore we use command_delay=0.1
client = Client(user="[email protected]", command_delay=0.1)
result = client.get_inventory("GE", "SNAA", "", "BHZ", start, end, instruments=True)
self.assertIn("GE", result)
self.assertIn("GE.SNAA", result)
self.assertIn("GE.SNAA..BHZ", result)
self.assertEqual(len(result["GE.SNAA..BHZ"]), 4)
# sort channel results
channel = result["GE.SNAA..BHZ"]
channel = sorted(channel, key=operator.itemgetter("starttime"))
# check for required attributes
self.assertEqual(channel[0].starttime, UTCDateTime("1997-03-03"))
self.assertEqual(channel[0].endtime, UTCDateTime("1999-10-11"))
self.assertEqual(channel[0].gain, 596224500.0)
self.assertEqual(channel[1].starttime, UTCDateTime("1999-10-11"))
self.assertEqual(channel[1].endtime, UTCDateTime("2003-01-10"))
self.assertEqual(channel[1].gain, 596224500.0)
self.assertEqual(channel[2].starttime, UTCDateTime("2003-01-10"))
self.assertEqual(channel[2].endtime, UTCDateTime(2011, 1, 15, 9, 56))
self.assertEqual(channel[2].gain, 588000000.0)
示例7: test_get_inventory
# 需要导入模块: from obspy.clients.arclink import Client [as 别名]
# 或者: from obspy.clients.arclink.Client import get_inventory [as 别名]
def test_get_inventory(self):
"""
Tests get_inventory method on various ArcLink nodes.
"""
client = Client(user='[email protected]')
dt = UTCDateTime(2010, 1, 1)
# 1 - GE network
result = client.get_inventory('GE', 'APE', starttime=dt,
endtime=dt + 1)
self.assertIn('GE', result)
self.assertIn('GE.APE', result)
# 2 - GE network
result = client.get_inventory('GE', 'APE', '', 'BHE', starttime=dt,
endtime=dt + 1, instruments=True)
self.assertIn('GE', result)
self.assertIn('GE.APE', result)
self.assertIn('GE.APE..BHE', result) # only for instruments=True
# 3 - BW network
result = client.get_inventory('BW', 'RJOB', starttime=dt,
endtime=dt + 1)
self.assertIn('BW', result)
self.assertIn('BW.RJOB', result)
# 4 - BW network
result = client.get_inventory('BW', 'MANZ', '', 'EHE', starttime=dt,
endtime=dt + 1, instruments=True)
self.assertIn('BW', result)
self.assertIn('BW.MANZ', result)
self.assertIn('BW.MANZ..EHE', result)
# 5 - unknown network 00 via webdc.eu:18002
result = client.get_inventory('00', '', starttime=dt, endtime=dt + 1)
self.assertIsInstance(result, AttribDict)
self.assertEqual(result, AttribDict({}))
# 6 - get channel gain without PAZ
start = UTCDateTime("1970-01-01 00:00:00")
end = UTCDateTime("2020-10-19 00:00:00")
result = client.get_inventory('BW', 'MANZ', '', 'EHE', start, end)
self.assertIn('BW', result)
self.assertIn('BW.MANZ', result)
self.assertIn('BW.MANZ..EHE', result)
self.assertEqual(len(result['BW.MANZ..EHE']), 2)
self.assertIn('gain', result['BW.MANZ..EHE'][0])
self.assertNotIn('paz', result['BW.MANZ..EHE'][0])
# 7 - history of instruments
# GE.SNAA sometimes needs a while therefore we use command_delay=0.1
client = Client(user='[email protected]', command_delay=0.1)
result = client.get_inventory('GE', 'SNAA', '', 'BHZ', start, end,
instruments=True)
self.assertIn('GE', result)
self.assertIn('GE.SNAA', result)
self.assertIn('GE.SNAA..BHZ', result)
self.assertEqual(len(result['GE.SNAA..BHZ']), 4)
# sort channel results
channel = result['GE.SNAA..BHZ']
channel = sorted(channel, key=operator.itemgetter('starttime'))
# check for required attributes
self.assertEqual(channel[0].starttime, UTCDateTime("1997-03-03"))
self.assertEqual(channel[0].endtime, UTCDateTime("1999-10-11"))
self.assertEqual(channel[0].gain, 596224500.0)
self.assertEqual(channel[1].starttime, UTCDateTime("1999-10-11"))
self.assertEqual(channel[1].endtime, UTCDateTime("2003-01-10"))
self.assertEqual(channel[1].gain, 596224500.0)
self.assertEqual(channel[2].starttime, UTCDateTime("2003-01-10"))
self.assertEqual(channel[2].endtime, UTCDateTime(2011, 1, 15, 9, 56))
self.assertEqual(channel[2].gain, 588000000.0)