Skip to content

Commit

Permalink
fix: checking type for vector plotter + adding name
Browse files Browse the repository at this point in the history
  • Loading branch information
Lachlan Grose committed Sep 13, 2021
1 parent 917711a commit 19c7d5e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion LoopStructural/visualisation/model_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,11 @@ def add_vector_field(self, geological_feature, **kwargs):
-------
"""
if isinstance(geological_feature,GeologicalFeature):
raise ValueError("{} is not a GeologicalFeature".format(type(geological_feature)))
logger.info("Adding vector field for %s " % (geological_feature.name))
locations = kwargs.get('locations', None)
name = kwargs.get('name', geological_feature.name)
if locations is None:
x = np.linspace(self.bounding_box[0, 0], self.bounding_box[1, 0], self.nsteps[0])
y = np.linspace(self.bounding_box[0, 1], self.bounding_box[1, 1], self.nsteps[1])
Expand All @@ -606,7 +609,7 @@ def add_vector_field(self, geological_feature, **kwargs):
# normalise
mask = ~np.any(np.isnan(vector), axis=1)
vector[mask, :] /= np.linalg.norm(vector[mask, :], axis=1)[:, None]
self._add_vector_marker(name, location, vector, **kwargs)
self._add_vector_marker(name, locations, vector, **kwargs)

return

Expand Down

0 comments on commit 19c7d5e

Please sign in to comment.