當前位置: 首頁>>代碼示例>>Python>>正文


Python Client.flinnengdahl方法代碼示例

本文整理匯總了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)
開發者ID:egdorf,項目名稱:obspy,代碼行數:34,代碼來源:test_client.py


注:本文中的obspy.iris.Client.flinnengdahl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。