Skip to content

Commit

Permalink
fix: adding exception when modelling faults with surfe
Browse files Browse the repository at this point in the history
  • Loading branch information
Lachlan Grose committed Sep 21, 2021
1 parent 14df33b commit 15806d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions LoopStructural/interpolators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
from LoopStructural.interpolators.structured_tetra import TetMesh
from LoopStructural.interpolators.structured_grid import StructuredGrid
from LoopStructural.interpolators.geological_interpolator import GeologicalInterpolator
from LoopStructural.interpolators.discrete_interpolator import DiscreteInterpolator

10 changes: 7 additions & 3 deletions LoopStructural/modelling/core/geological_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
FiniteDifferenceInterpolator as FDI
from LoopStructural.interpolators.piecewiselinear_interpolator import \
PiecewiseLinearInterpolator as PLI

from LoopStructural.interpolators import DiscreteInterpolator

from LoopStructural.interpolators.structured_grid import StructuredGrid
from LoopStructural.interpolators.structured_tetra import TetMesh
Expand All @@ -29,7 +29,7 @@
FoldEvent,
FoldFrame)

from LoopStructural.utils.exceptions import LoopException
from LoopStructural.utils.exceptions import LoopException, InterpolatorError
from LoopStructural.utils.helper import (all_heading, gradient_vec_names,
strike_dip_vector)

Expand Down Expand Up @@ -648,7 +648,7 @@ def get_interpolator(self, interpolatortype='FDI', nelements=1e4,
logger.info("Using surfe interpolator")
return Surfe(method)
logger.warning("No interpolator")
raise BaseException("Could not create interpolator")
raise InterpolatorError("Could not create interpolator")

def create_and_add_foliation(self, series_surface_data, tol = None, **kwargs):
"""
Expand Down Expand Up @@ -1187,6 +1187,10 @@ def create_and_add_fault(self,
displacement_scaled = displacement / self.scale_factor
# create fault frame
interpolator = self.get_interpolator(**kwargs)
# faults arent supported for surfe
if isinstance(interpolator, DiscreteInterpolator) == False:
logger.error("Change interpolator to a discrete interpolation algorithm FDI/PLI")
raise InterpolatorError('Faults not supported for {}'.format(kwargs['interpolatortype']))
fault_frame_builder = FaultBuilder(interpolator,
name=fault_surface_data,
model=self,
Expand Down

0 comments on commit 15806d7

Please sign in to comment.