Skip to content

Commit 7aeec5c

Browse files
committed
fix: code changes for merge
1 parent ab87b08 commit 7aeec5c

File tree

2 files changed

+144
-1
lines changed

2 files changed

+144
-1
lines changed

LoopStructural/modelling/intrusions/intrusion_builder.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ def __init__(
4545
name=self.name,
4646
)
4747

48+
# if 'intrusion_extent_calculation' in kwargs:
49+
# if kwargs['intrusion_extent_calculation'] == 'SGS':
50+
# self.intrusion_extent_calculation = 'SGS'
51+
# else:
52+
# logger.warning(kwargs['intrusion_extent_calculation'])
53+
# self.intrusion_extent_calculation = 'interpolated'
54+
55+
# else:
56+
# self.intrusion_extent_calculation = 'interpolated'
57+
4858
self._build_arguments = {}
4959
self.data = None
5060
self.data_prepared = False
@@ -738,9 +748,21 @@ def build(
738748
"""
739749
self.prepare_data(geometric_scaling_parameters)
740750
self.create_grid_for_evaluation()
751+
752+
# if self.intrusion_extent_calculation == 'SGS':
753+
754+
# lateral_extent_sgs_parameters = parameters_for_extent_sgs.get('lateral_extent_sgs_parameters', {})
755+
# vertical_extent_sgs_parameters = parameters_for_extent_sgs.get('vertical_extent_sgs_parameters', {})
756+
# self.set_l_sgs_GSLIBparameters(lateral_extent_sgs_parameters)
757+
# self.set_g_sgs_GSLIBparameters(vertical_extent_sgs_parameters)
758+
# self.make_l_sgs_variogram()
759+
# self.make_g_sgs_variogram()
760+
# self.simulate_lateral_thresholds()
761+
# self.simulate_growth_thresholds()
762+
763+
# elif self.intrusion_extent_calculation == 'interpolated':
741764
self.set_data_for_lateral_thresholds()
742765
self.set_data_for_vertical_thresholds()
743-
744766
def update(self):
745767
self.build(**self.build_arguments)
746768
self._up_to_date = True

LoopStructural/modelling/intrusions/intrusion_feature.py

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,127 @@ def evaluate_value(self, points):
391391

392392
return intrusion_sf
393393

394+
def evaluate_value_test(self, points):
395+
396+
"""
397+
Computes a distance scalar field to the intrusion contact (isovalue = 0).
398+
399+
Parameters
400+
------------
401+
points : numpy array (x,y,z), points where the IntrusionFeature is evaluated.
402+
403+
Returns
404+
------------
405+
intrusion_sf : numpy array, contains distance to intrusion contact
406+
407+
"""
408+
self.builder.up_to_date()
409+
410+
# compute coordinates values for each evaluated point
411+
intrusion_coord0_pts = self.intrusion_frame[0].evaluate_value(points)
412+
intrusion_coord1_pts = self.intrusion_frame[1].evaluate_value(points)
413+
intrusion_coord2_pts = self.intrusion_frame[2].evaluate_value(points)
414+
415+
self.evaluated_points = [
416+
points,
417+
intrusion_coord0_pts,
418+
intrusion_coord1_pts,
419+
intrusion_coord2_pts,
420+
421+
]
422+
423+
424+
thresholds, residuals, conceptual = self.interpolate_lateral_thresholds(
425+
intrusion_coord1_pts
426+
)
427+
428+
if self.intrusion_frame.builder.marginal_faults is not None:
429+
c2_minside_threshold = np.zeros_like(intrusion_coord2_pts)
430+
c2_maxside_threshold = thresholds[1]
431+
432+
433+
else:
434+
c2_minside_threshold = thresholds[0]
435+
c2_maxside_threshold = thresholds[1]
436+
437+
438+
thresholds, residuals, conceptual = self.interpolate_vertical_thresholds(
439+
intrusion_coord1_pts, intrusion_coord2_pts
440+
)
441+
c0_minside_threshold = thresholds[1]
442+
c0_maxside_threshold = thresholds[0]
443+
444+
445+
mid_point = c0_minside_threshold + (
446+
(c0_maxside_threshold - c0_minside_threshold) / 2
447+
)
448+
449+
450+
451+
mod_intrusion_coord0_pts = intrusion_coord0_pts - mid_point
452+
mod_c0_minside_threshold = c0_minside_threshold - mid_point
453+
mod_c0_maxside_threshold = c0_maxside_threshold + mid_point
454+
455+
a = (mod_intrusion_coord0_pts >= mid_point)*(c2_minside_threshold < intrusion_coord2_pts)*(intrusion_coord2_pts < c2_maxside_threshold)
456+
b = (mod_intrusion_coord0_pts <= mid_point)*(c2_minside_threshold < intrusion_coord2_pts)*(intrusion_coord2_pts < c2_maxside_threshold)
457+
c = (mod_intrusion_coord0_pts <= mid_point)*(mod_intrusion_coord0_pts >= mod_c0_minside_threshold)*(c2_minside_threshold < intrusion_coord2_pts)*(intrusion_coord2_pts < c2_maxside_threshold)
458+
459+
intrusion_sf = mod_intrusion_coord0_pts
460+
intrusion_sf[a] = mod_intrusion_coord0_pts[a] - mod_c0_maxside_threshold[a]
461+
intrusion_sf[b] = abs(mod_c0_minside_threshold[b] + mod_intrusion_coord0_pts[b])
462+
intrusion_sf[c] = mod_intrusion_coord0_pts[c] - mod_c0_minside_threshold[c]
463+
464+
465+
# a = intrusion_coord2_pts >= c2_maxside_threshold
466+
# b = intrusion_coord2_pts <= c2_minside_threshold
467+
# c = (
468+
# (c2_minside_threshold < intrusion_coord2_pts)
469+
# * (intrusion_coord2_pts < c2_maxside_threshold)
470+
# * (intrusion_coord0_pts <= c0_minside_threshold)
471+
# )
472+
# d = (
473+
# (c2_minside_threshold < intrusion_coord2_pts)
474+
# * (intrusion_coord2_pts < c2_maxside_threshold)
475+
# * (intrusion_coord0_pts >= c0_maxside_threshold)
476+
# )
477+
# e = (
478+
# (c2_minside_threshold < intrusion_coord2_pts)
479+
# * (intrusion_coord2_pts < c2_maxside_threshold)
480+
# * (mid_point >= intrusion_coord0_pts)
481+
# * (intrusion_coord0_pts > c0_minside_threshold)
482+
# )
483+
# f = (
484+
# (c2_minside_threshold < intrusion_coord2_pts)
485+
# * (intrusion_coord2_pts < c2_maxside_threshold)
486+
# * (mid_point < intrusion_coord0_pts)
487+
# * (intrusion_coord0_pts < c0_maxside_threshold)
488+
# )
489+
490+
# mod_Smin_thresholds = intrusion_coord2_pts - c2_minside_threshold
491+
# mod_Smax_thresholds = intrusion_coord2_pts - c2_maxside_threshold
492+
# mod_Gmin_thresholds = intrusion_coord0_pts - c0_minside_threshold
493+
# mod_Gmax_thresholds = intrusion_coord0_pts - c0_maxside_threshold
494+
495+
# intrusion_sf = (
496+
# a * mod_Smax_thresholds
497+
# + b * abs(mod_Smin_thresholds)
498+
# + c * abs(mod_Gmin_thresholds)
499+
# + d * mod_Gmax_thresholds
500+
# - e * mod_Gmin_thresholds
501+
# + f * mod_Gmax_thresholds
502+
# ) * (
503+
# -1
504+
# multiply by (-1) so intrusions can be used as unconformities
505+
506+
# if self.intrusion_frame.builder.marginal_faults is not None:
507+
# for fault in self.intrusion_frame.builder.marginal_faults.keys():
508+
# intrusion_sf
509+
# self.intrusion_frame.builder.marginal_faults
510+
511+
512+
# self.intrusion_indicator_function = indicator_fx
513+
514+
return intrusion_sf
394515

395516
def evaluate_value_with_SGS(self, points):
396517

0 commit comments

Comments
 (0)