本文整理匯總了Python中obspy.iris.Client.flinnengdahl方法的典型用法代碼示例。如果您正苦於以下問題:Python Client.flinnengdahl方法的具體用法?Python Client.flinnengdahl怎麽用?Python Client.flinnengdahl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類obspy.iris.Client
的用法示例。
在下文中一共展示了Client.flinnengdahl方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_flinnengdahl
# 需要導入模塊: from obspy.iris import Client [as 別名]
# 或者: from obspy.iris.Client import flinnengdahl [as 別名]
def test_flinnengdahl(self):
"""
Tests calculation of Flinn-Engdahl region code or name.
"""
client = Client()
# code
result = client.flinnengdahl(lat=-20.5, lon=-100.6, rtype="code")
self.assertEquals(result, 683)
# w/o kwargs
result = client.flinnengdahl(-20.5, -100.6, "code")
self.assertEquals(result, 683)
# region
result = client.flinnengdahl(lat=42, lon=-122.24, rtype="region")
self.assertEquals(result, "OREGON")
# w/o kwargs
result = client.flinnengdahl(42, -122.24, "region")
self.assertEquals(result, "OREGON")
# both
result = client.flinnengdahl(lat=-20.5, lon=-100.6, rtype="both")
self.assertEquals(result, (683, "SOUTHEAST CENTRAL PACIFIC OCEAN"))
# w/o kwargs
result = client.flinnengdahl(-20.5, -100.6, "both")
self.assertEquals(result, (683, "SOUTHEAST CENTRAL PACIFIC OCEAN"))
# default rtype
result = client.flinnengdahl(lat=42, lon=-122.24)
self.assertEquals(result, (32, "OREGON"))
# w/o kwargs
# outside boundaries
self.assertRaises(Exception, client.flinnengdahl, lat=-90.1, lon=0)
self.assertRaises(Exception, client.flinnengdahl, lat=90.1, lon=0)
self.assertRaises(Exception, client.flinnengdahl, lat=0, lon=-180.1)
self.assertRaises(Exception, client.flinnengdahl, lat=0, lon=180.1)