Reputation: 196
I have 80 points one line that crosses one particular point. I want to calculate the distance between that reference point and each station and it should be positive and negative. I tried following way but it gives me only positive distance value,
stla = st[0].stats.sac['stla'] #station lat
stlo = st[0].stats.sac['stlo'] #station lon
#crossover distance
crlo = 104.499765143
crla = 29.4742139251
dist1 = gps2dist_azimuth(stla,stlo, crla,crlo)
dist1=dist1[0]`
I got this output (in meters)
`1549.9072755468023
2314.5301492042786
1978.8805972408672
604.7927668562546
195.07039250670383
2177.129827481811
212.6443078339846
863.9573297833116
1615.5449194502921
1219.2825679960995
1564.226848063852
2600.316245974806
741.5826151164387
665.5972988769541
2335.6051118556975
What I expected it should be like this (In Km, please ignore the units difference):
0.5983164169
0.637797120571
0.732341381346
0.776296768282
0.83927019696
0.864898580629
0.927615280754
0.9785794379
1.07543888694
1.09081523648
1.14869546005
1.18406238008
1.25599403922
1.33394492802
1.3999813227
1.44882008293
1.51207083251
1.57852778971
I can calculate from GMT with this command by keeping one point as the center point
gmt project 1.txt -C104.499765143/29.4742139251 -A87.64 -Fpq -Q
1.txt is the station's position and -C is the center point,-A represents the azimuth.
Upvotes: 0
Views: 104