Skip to content

Commit 3089324

Browse files
committed
Merge branch 'dev' of https://github.com/Loop3D/LoopStructural into dev
2 parents 6203028 + f7d348a commit 3089324

File tree

6 files changed

+32
-14
lines changed

6 files changed

+32
-14
lines changed

LoopStructural/modelling/core/geological_model.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def __init__(self, origin, maximum, rescale=True, nsteps=(40, 40, 40),
140140
self.bounding_box[1, :] = self.maximum - self.origin
141141
self.bounding_box[1, :] = self.maximum - self.origin
142142
if rescale:
143-
self.scale_factor = np.max(lengths,dtype=float)
143+
self.scale_factor = float(np.max(lengths))
144144
logger.info('Rescaling model using scale factor {}'.format(self.scale_factor))
145145
self._str+='Model rescale factor: {} \n'.format(self.scale_factor)
146146
self._str+='The model contains {} GeologicalFeatures \n'.format(len(self.features))
@@ -1141,25 +1141,30 @@ def create_and_add_fault(self,
11411141
mask = np.logical_and(fault_frame_data['coord']==1,~np.isnan(fault_frame_data['gz']))
11421142
if fault_slip_vector is None:
11431143
fault_slip_vector = fault_frame_data.loc[mask,['gx','gy','gz']].mean(axis=0).to_numpy()
1144+
if fault_center is not None:
1145+
fault_center = self.scale(fault_center,inplace=False)
11441146
if fault_center is None:
11451147
# if we haven't defined a fault centre take the center of mass for lines assocaited with
11461148
# the fault trace
11471149
mask = np.logical_and(fault_frame_data['coord']==0,fault_frame_data['val']==0)
11481150
fault_center = fault_frame_data.loc[mask,['X','Y','Z']].mean(axis=0).to_numpy()
1149-
if influence_distance:
1150-
influence_distance=fault_influence/self.scale_factor
1151-
if horizontal_radius:
1152-
horizontal_radius=fault_extent/self.scale_factor
1153-
if vertical_radius:
1154-
vertical_radius=fault_vectical_radius/self.scale_factor
1151+
if fault_influence:
1152+
fault_influence=fault_influence/self.scale_factor
1153+
if fault_extent:
1154+
fault_extent=fault_extent/self.scale_factor
1155+
if fault_vectical_radius:
1156+
fault_vectical_radius=fault_vectical_radius/self.scale_factor
11551157
fault_frame_builder.create_data_from_geometry(fault_frame_data,
1156-
self.scale(fault_center),
1158+
fault_center,
11571159
fault_normal_vector,
11581160
fault_slip_vector,
11591161
influence_distance=fault_influence,
11601162
horizontal_radius=fault_extent,
11611163
vertical_radius=fault_vectical_radius
11621164
)
1165+
if fault_influence == None or fault_extent == None or fault_vectical_radius == None:
1166+
fault_frame_builder.origin = self.origin
1167+
fault_frame_builder.maximum = self.maximum
11631168
fault_frame_builder.set_mesh_geometry(kwargs.get('fault_buffer',0.1))
11641169
# fault_frame_builder.add_data_from_data_frame(fault_frame_data)
11651170
# check if this fault overprint any existing faults exist in the stack

LoopStructural/modelling/fault/fault_builder.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ def create_data_from_geometry(self,
5151
vertical_radius : double
5252
fault volume radius in the slip direction
5353
"""
54+
normal_vector/=np.linalg.norm(normal_vector)
55+
slip_vector/=np.linalg.norm(slip_vector)
5456
strike_vector = np.cross(normal_vector,slip_vector)
5557
fault_edges = np.zeros((2,3))
5658
fault_tips = np.zeros((2,3))

LoopStructural/modelling/features/geological_feature.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ def evaluate_value(self, evaluation_points):
120120
numpy array containing evaluated values
121121
122122
"""
123+
#TODO need to add a generic type checker for all methods
124+
#if evaluation_points is not a numpy array try and convert
125+
#otherwise error
123126
self.builder.up_to_date()
124127
# check if the points are within the display region
125128
v = np.zeros(evaluation_points.shape[0])

LoopStructural/modelling/features/structural_frame.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,7 @@ def evaluate_value(self, evaluation_points):
107107
v[:,1] = self.features[1].evaluate_value(evaluation_points)
108108
v[:,2] = self.features[2].evaluate_value(evaluation_points)
109109
return v
110-
# return (self.features[0].evaluate_value(evaluation_points),
111-
# self.features[1].evaluate_value(evaluation_points),
112-
# self.features[2].evaluate_value(evaluation_points))
113-
110+
114111
def evaluate_gradient(self, evaluation_points, i=None):
115112
"""
116113
Evaluate the gradient of the structural frame.

LoopStructural/utils/map2loop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ def build_model(m2l_data, skip_faults = False, unconformities=False, fault_param
317317
faults.append(model.create_and_add_fault(f,
318318
-m2l_data['max_displacement'][f],
319319
faultfunction='BaseFault',
320-
fault_slip_vector=np.array([0,0,-1]),
320+
fault_slip_vector=np.array([0.,0.,-1.]),
321321
fault_center=fault_center,
322322
fault_extent=fault_extent,
323323
fault_influence=fault_influence,

LoopStructural/visualisation/model_visualisation.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,18 @@ def add_fault_displacements(self, cmap = 'rainbow', **kwargs):
492492
vmin = kwargs.get('vmin', np.nanmin(vals))
493493
vmax = kwargs.get('vmax', np.nanmax(vals))
494494
surf.colourmap(cmap, range=(vmin, vmax))
495-
495+
496+
def add_fault_ellipse(self, faults=None, **kwargs):
497+
from matplotlib.patches import Ellipse
498+
for k, f in self.model.stratigraphic_column['faults'].items():
499+
center = self.model.rescale(f['FaultCenter'])
500+
e = Ellipse((center[0],center[1]),
501+
f['HorizontalRadius']*2,
502+
f['InfluenceDistance']*2,
503+
360-f['FaultDipDirection'],
504+
facecolor='None',edgecolor='k')
505+
506+
self.ax.add_patch(e)
496507
def add_model_surfaces(self, faults = True, cmap=None, fault_colour='black',**kwargs):
497508
"""Add surfaces for all of the interfaces in the model
498509

0 commit comments

Comments
 (0)