Commit bfa3a2c5 authored by Kris Vanneste's avatar Kris Vanneste
Browse files

Updated get_mean_strike method of LineData to changes in mapping.geotools.angle module.

git-svn-id: https://svn.seismo.oma.be/svn/seismo/mapping/layeredbasemap/trunk@5760 40b490c5-b4d9-47cb-8714-9bef99b524d5
parent a68ac6bd
...@@ -138,14 +138,15 @@ class LineData(SingleData): ...@@ -138,14 +138,15 @@ class LineData(SingleData):
def get_mean_strike(self): def get_mean_strike(self):
import mapping.geotools.geodetic as geodetic import mapping.geotools.geodetic as geodetic
from mapping.geotools.angle import mean_angle from mapping.geotools.angle import Azimuth
lons, lats = np.array(self.lons), np.array(self.lats) lons, lats = np.array(self.lons), np.array(self.lats)
lons1, lats1 = lons[:-1], lats[:-1] lons1, lats1 = lons[:-1], lats[:-1]
lons2, lats2 = lons[1:], lats[1:] lons2, lats2 = lons[1:], lats[1:]
distances = geodetic.spherical_distance(lons1, lats1, lons2, lats2) distances = geodetic.spherical_distance(lons1, lats1, lons2, lats2)
azimuths = geodetic.spherical_azimuth(lons1, lats1, lons2, lats2) azimuths = geodetic.spherical_azimuth(lons1, lats1, lons2, lats2)
azimuths = Azimuth(azimuths, 'deg')
weights = distances / np.add.reduce(distances) weights = distances / np.add.reduce(distances)
mean_strike = mean_angle(azimuths, weights) mean_strike = azimuths.mean(weights).deg()
return mean_strike return mean_strike
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment