Commit 2a93dc3e authored by Kris Vanneste's avatar Kris Vanneste
Browse files

Fixed get_min_distance and get_nearest_index_to methods of LineData.

git-svn-id: https://svn.seismo.oma.be/svn/seismo/mapping/layeredbasemap/trunk@7631 40b490c5-b4d9-47cb-8714-9bef99b524d5
parent 2ff37bd7
...@@ -232,7 +232,7 @@ class LineData(SingleData): ...@@ -232,7 +232,7 @@ class LineData(SingleData):
float, distance (in m) float, distance (in m)
""" """
distances = self.calc_distances_to(feature) distances = self.calc_distances_to(feature)
return distances.min(axis=0) return distances.min()
def get_nearest_index_to(self, feature): def get_nearest_index_to(self, feature):
""" """
...@@ -245,7 +245,9 @@ class LineData(SingleData): ...@@ -245,7 +245,9 @@ class LineData(SingleData):
int, point index int, point index
""" """
distances = self.calc_distances_to(feature) distances = self.calc_distances_to(feature)
return np.argmin(distances, axis=0) if distances.ndim == 2:
distances = np.nanmin(distances, axis=1)
return np.argmin(distances)
## Backwards compatibility ## Backwards compatibility
get_nearest_index_to_point = get_nearest_index_to get_nearest_index_to_point = get_nearest_index_to
......
Markdown is supported
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