Skip to content

Commit

Permalink
fix: adding polarity to LS datastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
Lachlan Grose committed Dec 3, 2021
1 parent 2e185b5 commit 61842f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion LoopStructural/modelling/core/geological_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,13 +509,17 @@ def data(self, data):
self._data[h] = 1.0
if h == "coord":
self._data[h] = 0
if h == "polarity":
self._data[h] = 1.
# LS wants polarity as -1 or 1, change 0 to -1
self._data.loc[self._data["polarity"]==0, "polarity"] = -1.
self.data.loc[np.isnan(self.data["w"]), "w"] = 1.0
if "strike" in self._data and "dip" in self._data:
logger.info("Converting strike and dip to vectors")
mask = np.all(~np.isnan(self._data.loc[:, ["strike", "dip"]]), axis=1)
self._data.loc[mask, gradient_vec_names()] = strike_dip_vector(
self._data.loc[mask, "strike"], self._data.loc[mask, "dip"]
)
)*self._data.loc[mask, "polarity"][:,None]
self._data.drop(["strike", "dip"], axis=1, inplace=True)

def set_model_data(self, data):
Expand Down
3 changes: 3 additions & 0 deletions LoopStructural/utils/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ def interface_name():
def feature_name():
return ["feature_name"]

def polarity_name():
return ["polarity"]

def all_heading():
return (
Expand All @@ -412,6 +414,7 @@ def all_heading():
+ coord_name()
+ feature_name()
+ interface_name()
+ polarity_name()
)


Expand Down

0 comments on commit 61842f0

Please sign in to comment.