Skip to content

Commit

Permalink
fix: merging master intro intrusions
Browse files Browse the repository at this point in the history
  • Loading branch information
Lachlan Grose committed Sep 8, 2022
1 parent 16af693 commit d5aa043
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 35 deletions.
4 changes: 0 additions & 4 deletions LoopStructural/modelling/core/geological_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1123,10 +1123,6 @@ def create_and_add_intrusion(
logger.error("Libraries not installed")
raise Exception("Libraries not installed")

self.parameters["features"].append(
{"feature_type": "intrusion", "feature_name": intrusion_name, **kwargs}
)

intrusion_data = self.data[self.data["feature_name"] == intrusion_name].copy()
intrusion_frame_data = self.data[
self.data["feature_name"] == intrusion_frame_name
Expand Down
2 changes: 2 additions & 0 deletions LoopStructural/modelling/features/_base_geological_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def model(self, model):
# causes circular import, could delay import?
if type(model) == GeologicalModel:
self._model = model
elif model is None:
return
else:
raise TypeError("Model must be a GeologicalModel")

Expand Down
4 changes: 0 additions & 4 deletions LoopStructural/modelling/intrusions/intrusion_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@

from LoopStructural.modelling.intrusions.intrusion_support_functions import (
grid_from_array,
shortest_path,
element_neighbour,
index_min,
new_inlet,
)

from .geometric_scaling_functions import *
Expand Down
38 changes: 11 additions & 27 deletions LoopStructural/modelling/intrusions/intrusion_frame_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,7 @@ def add_contact_anisotropies(self, series_list=None, **kwargs):
== series_list[i].name
].copy()
data_array_temp = data_temp.loc[:, ["X", "Y", "Z"]].to_numpy()
series_i_vals = series_list[i]["feature"].evaluate_value(
data_array_temp
)
series_i_vals = series_list[i].evaluate_value(data_array_temp)
series_array = np.zeros([len(data_array_temp), 4])
series_array[:, :3] = data_array_temp
series_array[:, 3] = series_i_vals
Expand Down Expand Up @@ -327,9 +325,7 @@ def add_steps_stratigraphic_units(self):
.copy()
.to_numpy()
)
series_values = series_from_name["feature"].evaluate_value(
data_points_xyz
)
series_values = series_from_name.evaluate_value(data_points_xyz)
series_values_mod = series_values.reshape(len(series_values), 1)
contact_clustering = KMeans(n_clusters=2, random_state=0).fit(
series_values_mod
Expand Down Expand Up @@ -386,7 +382,7 @@ def add_steps_stratigraphic_units(self):
)
self.intrusion_steps[step_i]["unit_from_std"] = std_backup
else:
series_values = series_from_name["feature"].evaluate_value(
series_values = series_from_name.evaluate_value(
data_points_from_xyz
)
# print(len(step_structure_points_vals), len(series_values))
Expand Down Expand Up @@ -432,9 +428,7 @@ def add_steps_stratigraphic_units(self):
)
self.intrusion_steps[step_i]["unit_to_std"] = std_backup
else:
series_values = series_to_name["feature"].evaluate_value(
data_points_to_xyz
)
series_values = series_to_name.evaluate_value(data_points_to_xyz)
# print(len(step_structure_points_vals), len(series_values))
mask = step_structure_points_vals > 0
if len(mask) > 0:
Expand Down Expand Up @@ -597,7 +591,7 @@ def indicator_function_contacts(self, delta=None):
seriesi_std = self.anisotropies_series_parameters[contact_id][2]

series_id.faults_enabled = True
seriesi_values = series_id["feature"].evaluate_value(grid_points)
seriesi_values = series_id.evaluate_value(grid_points)

# apend associated scalar field values to each anisotropy
self.anisotropies_series_parameters[contact_id].append(seriesi_values)
Expand Down Expand Up @@ -783,16 +777,12 @@ def create_intrusion_network(self, **kwargs):
grid_points
)

series_from_gridpoints_vals = series_from_name[
"feature"
].evaluate_value(grid_points)
series_from_gridpoints_vals = series_from_name.evaluate_value(grid_points)
if series_from_name == series_to_name:
series_to_gridpoints_vals = series_from_gridpoints_vals

else:
series_to_gridpoints_vals = series_to_name[
"feature"
].evaluate_value(grid_points)
series_to_gridpoints_vals = series_to_name.evaluate_value(grid_points)

contacts0_val_min = self.intrusion_steps[step_i].get(
"unit_from_mean"
Expand Down Expand Up @@ -882,9 +872,7 @@ def create_intrusion_network(self, **kwargs):

series_id = self.anisotropies_series_list[0]
series_id.faults_enabled = True
strat_gradient_grid_points = series_id["feature"].evaluate_gradient(
grid_points
)
strat_gradient_grid_points = series_id.evaluate_gradient(grid_points)

# If intrusion network is built usinf roof/top contact, then change vector direction
if (
Expand Down Expand Up @@ -947,9 +935,7 @@ def create_intrusion_network(self, **kwargs):
if (
inlet_anisotropy in self.anisotropies_series_list
): # if inlet anisotropy type is series
sf_inlet_anisotropy = inlet_anisotropy["feature"].evaluate_value(
grid_points
)
sf_inlet_anisotropy = inlet_anisotropy.evaluate_value(grid_points)

else: # otherwise, it is a fault:
sf_inlet_anisotropy = inlet_anisotropy[0].evaluate_value(grid_points)
Expand All @@ -958,9 +944,7 @@ def create_intrusion_network(self, **kwargs):
len(self.anisotropies_sequence) - 1
]
if outlet_anisotropy in self.anisotropies_series_list:
sf_outlet_anisotropy = outlet_anisotropy["feature"].evaluate_value(
grid_points
)
sf_outlet_anisotropy = outlet_anisotropy.evaluate_value(grid_points)

else:
sf_outlet_anisotropy = outlet_anisotropy[0].evaluate_value(grid_points)
Expand Down Expand Up @@ -1137,7 +1121,7 @@ def set_intrusion_frame_data(self, intrusion_frame_data, intrusion_network_point
scaled_inet_points = intrusion_network_points[:, :3]
coord_0_values = pd.DataFrame(scaled_inet_points, columns=["X", "Y", "Z"])
coord_0_values["val"] = 0
coord_0_values["coord"] = 0
coord_0_values["coord"] = 0
coord_0_values["feature_name"] = self.name
coord_0_values["w"] = 1

Expand Down

0 comments on commit d5aa043

Please sign in to comment.