From 19c7d5e7f0bfbccd78aec6fabe52c39e9ecba5b0 Mon Sep 17 00:00:00 2001 From: Lachlan Grose Date: Mon, 13 Sep 2021 16:22:30 +1000 Subject: [PATCH] fix: checking type for vector plotter + adding name --- LoopStructural/visualisation/model_plotter.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/LoopStructural/visualisation/model_plotter.py b/LoopStructural/visualisation/model_plotter.py index 000ac3df4..64da30d31 100644 --- a/LoopStructural/visualisation/model_plotter.py +++ b/LoopStructural/visualisation/model_plotter.py @@ -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]) @@ -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