22
33from LoopStructural .modelling .fault .fault_function_feature import FaultDisplacementFeature
44from LoopStructural .modelling .fault .fault_function import BaseFault
5- from LoopStructural .utils import getLogger
5+ from LoopStructural .utils import getLogger , NegativeRegion , PositiveRegion
66logger = getLogger (__name__ )
77from concurrent .futures import ThreadPoolExecutor
88import numpy as np
@@ -347,19 +347,24 @@ def apply_to_points(self, points):
347347 newp [mask , :] += g
348348 return newp
349349
350- def add_abutting_fault (self ,abutting_fault_feature ):
351- pts = self .faultframe [0 ].builder .data [['X' ,'Y' ,'Z' ]].to_numpy ()#get_value_constraints()
350+ def add_abutting_fault (self ,abutting_fault_feature ,positive = None ):
352351 # check whether the fault is on the hanging wall or footwall of abutting fault
353-
354- def abutting_region (pos ):
352+ abutting_region = None
353+ if positive is None :
354+ pts = self .faultframe [0 ].builder .data [['X' ,'Y' ,'Z' ]].to_numpy ()#get_value_constraints()
355355 abut_value = np .nanmedian (abutting_fault_feature .evaluate_value (pts ))
356- if abut_value > 0 :
357- ## adding the nan check avoids truncating the fault at the edge of the abutting fault bounding box.
358- ## it makes the assumption that the abutted fault is not drawn across the abutting fault... but this should be ok
359- return np .logical_or (abutting_fault_feature .evaluate_value (pos ) > 0 ,
360- np .isnan (abutting_fault_feature .evaluate_value (pos )))
361- if abut_value < 0 :
362- return np .logical_or (abutting_fault_feature .evaluate_value (pos ) < 0 ,
363- np .isnan (abutting_fault_feature .evaluate_value (pos )))
356+ positive = abut_value > 0
357+ if positive :
358+ abutting_region = PositiveRegion (abutting_fault_feature )
359+ if positive == False :
360+ abutting_region = NegativeRegion (abutting_fault_feature )
361+ # if positive == True:
362+ # ## adding the nan check avoids truncating the fault at the edge of the abutting fault bounding box.
363+ # ## it makes the assumption that the abutted fault is not drawn across the abutting fault... but this should be ok
364+ # return np.logical_or(abutting_fault_feature.evaluate_value(pos) > 0,
365+ # np.isnan(abutting_fault_feature.evaluate_value(pos)))
366+ # if positive == False:
367+ # return np.logical_or(abutting_fault_feature.evaluate_value(pos) < 0,
368+ # np.isnan(abutting_fault_feature.evaluate_value(pos)))
364369 self .abut [abutting_fault_feature .name ] = abutting_region
365370 self .faultframe [0 ].add_region (abutting_region )
0 commit comments