本文整理匯總了Python中obspy.iris.Client.distaz方法的典型用法代碼示例。如果您正苦於以下問題:Python Client.distaz方法的具體用法?Python Client.distaz怎麽用?Python Client.distaz使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類obspy.iris.Client
的用法示例。
在下文中一共展示了Client.distaz方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_distaz
# 需要導入模塊: from obspy.iris import Client [as 別名]
# 或者: from obspy.iris.Client import distaz [as 別名]
def test_distaz(self):
"""
Tests distance and azimuth calculation between two points on a sphere.
"""
client = Client()
# normal request
result = client.distaz(stalat=1.1, stalon=1.2, evtlat=3.2, evtlon=1.4)
self.assertAlmostEquals(result["distance"], 2.09554)
self.assertAlmostEquals(result["backazimuth"], 5.46946)
self.assertAlmostEquals(result["azimuth"], 185.47692)
# w/o kwargs
result = client.distaz(1.1, 1.2, 3.2, 1.4)
self.assertAlmostEquals(result["distance"], 2.09554)
self.assertAlmostEquals(result["backazimuth"], 5.46946)
self.assertAlmostEquals(result["azimuth"], 185.47692)
# missing parameters
self.assertRaises(Exception, client.distaz, stalat=1.1)
self.assertRaises(Exception, client.distaz, 1.1)
self.assertRaises(Exception, client.distaz, stalat=1.1, stalon=1.2)
self.assertRaises(Exception, client.distaz, 1.1, 1.2)
示例2: az2
# 需要導入模塊: from obspy.iris import Client [as 別名]
# 或者: from obspy.iris.Client import distaz [as 別名]
def az2(sfile):
azDic = {}
client = Client() #Creando objeto cliente
evtlat,evtlon = evcor(sfile) #Obteniendo las coordenadas del evento del sfile en decimal
infile = open(sfile,'rU')
for line in infile:
if line[9:11] == 'ES':
#print 'Dentro del if'
station_name = line[1:6].split(' ')[0]
Baz = client.distaz(stalat=stacor('corstations.txt')[station_name][0], stalon=stacor('corstations.txt')[station_name][1], evtlat=evtlat, evtlon=evtlon)
azDic[station_name] = Baz['backazimuth']
return azDic
示例3: Client
# 需要導入模塊: from obspy.iris import Client [as 別名]
# 或者: from obspy.iris.Client import distaz [as 別名]
#!/usr/bin/python
from obspy.iris import Client
#from obspy.fdsn import Client
client = Client()
result = client.distaz(stalat=1.1, stalon=1.2, evtlat=3.2, evtlon=1.4)
print(result['distance'])
print(result['backazimuth'])
print(result['azimuth'])