Skip to content

Commit

Permalink
fix: 🚑 surfe import was failing
Browse files Browse the repository at this point in the history
  • Loading branch information
Lachlan Grose committed Feb 24, 2022
1 parent 8881134 commit 63d61a4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
13 changes: 7 additions & 6 deletions LoopStructural/interpolators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ class InterpolatorType(IntEnum):
from LoopStructural.interpolators._discrete_fold_interpolator import (
DiscreteFoldInterpolator,
)
from LoopStructural.interpolators._surfe_wrapper import SurfeRBFInterpolator

if LoopStructural.experimental:
logger.warning(
"Using experimental interpolators: P1Interpolator and P2Interpolator"
)
from ._p1interpolator import P1Interpolator
from ._p2interpolator import P2Interpolator

logger.warning(
"Using experimental interpolators: P1Interpolator and P2Interpolator"
)
from ._p1interpolator import P1Interpolator
from ._p2interpolator import P2Interpolator
3 changes: 1 addition & 2 deletions LoopStructural/interpolators/_surfe_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
import sys, os

from LoopStructural.utils.helper import get_vectors
from .geological_interpolator import GeologicalInterpolator
from LoopStructural.interpolators import GeologicalInterpolator

import logging
import numpy as np

from LoopStructural.utils import getLogger

logger = getLogger(__name__)

import surfepy


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

if LoopStructural.experimental:
from LoopStructural.interpolators import P2Interpolator
# if LoopStructural.experimental:
from LoopStructural.interpolators import P2Interpolator
try:
from LoopStructural.surfe_wrapper import SurfeRBFInterpolator as Surfe
from LoopStructural.interpolators import SurfeRBFInterpolator as Surfe

surfe = True

Expand Down Expand Up @@ -791,15 +791,6 @@ def get_interpolator(
return DFI(mesh, kwargs["fold"])
if interpolatortype == "Surfe" or interpolatortype == "surfe":
# move import of surfe to where we actually try and use it
try:
from LoopStructural.interpolators.surfe_wrapper import (
SurfeRBFInterpolator as Surfe,
)

surfe = True

except ImportError:
surfe = False
if not surfe:
logger.warning("Cannot import Surfe, try another interpolator")
raise ImportError("Cannot import surfepy, try pip install surfe")
Expand Down

0 comments on commit 63d61a4

Please sign in to comment.