Skip to content

Commit

Permalink
fix: changing import error message to warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Lachlan Grose committed Apr 27, 2022
1 parent 399ebbe commit de22530
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 27 deletions.
4 changes: 3 additions & 1 deletion LoopStructural/modelling/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
try:
from LoopStructural.modelling.input.project_file import LoopProjectfileProcessor
except (LoopImportError, ImportError):
logger.error("Loop project file cannot be imported")
logger.warning(
"Cannot use LoopProjectfileProcessor: Loop project file cannot be imported, try installing LoopProjectFile"
)
from LoopStructural.modelling.features import StructuralFrame
from LoopStructural.modelling.features import StructuralFrameBuilder
from LoopStructural.modelling.fault import FaultBuilder
Expand Down
42 changes: 22 additions & 20 deletions LoopStructural/modelling/intrusions/intrusion_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,27 @@
index_min,
new_inlet,
)

logger = getLogger(__name__)

# import GSLIB library
try:
import geostatspy.GSLIB as GSLIB # GSLIB utilities, viz and wrapped functions

except ImportError:
logger.error("GeostatPy not installed \n" "pip install geostatspy")
logger.warning(
"Cannot use Intrusions: GeostatPy not installed \n" "pip install geostatspy"
)
raise ImportError("GSLIB")
try:
import geostatspy.geostats as geostats # GSLIB converted to Python
except ImportError:
logger.error("GeostatPy not installed \n" "pip install geostatspy")
logger.warning(
"Cannot use Intrusions: GeostatPy not installed \n" "pip install geostatspy"
)
raise ImportError("geostats")



class IntrusionBuilder:
def __init__(self, frame, model=None, name="intrusion"):
self.name = name
Expand Down Expand Up @@ -261,14 +265,13 @@ def set_l_sgs_GSLIBparameters(self, lateral_simulation_parameters):
"ndmin": ndmin,
"ndmax": ndmax,
"radius": radius,
"nugget" : nugget,
"nst" : nst,
"it1" : it1,
"cc1" : cc1,
"azi1" : azi1,
"hmaj1" : hmaj1,
"hmin1" : hmin1

"nugget": nugget,
"nst": nst,
"it1": it1,
"cc1": cc1,
"azi1": azi1,
"hmaj1": hmaj1,
"hmin1": hmin1,
}

self.lateral_sgs_parameters = l_parameters
Expand Down Expand Up @@ -349,13 +352,13 @@ def set_g_sgs_GSLIBparameters(self, vertical_simulation_parameters):
"ndmin": ndmin,
"ndmax": ndmax,
"radius": radius,
"nugget" : nugget,
"nst" : nst,
"it1" : it1,
"cc1" : cc1,
"azi1" : azi1,
"hmaj1" : hmaj1,
"hmin1" : hmin1
"nugget": nugget,
"nst": nst,
"it1": it1,
"cc1": cc1,
"azi1": azi1,
"hmaj1": hmaj1,
"hmin1": hmin1,
}

self.vertical_sgs_parameters = g_parameters
Expand Down Expand Up @@ -386,7 +389,7 @@ def make_l_sgs_variogram(self):
azi1 = self.lateral_sgs_parameters.get("azi1")
hmaj1 = self.lateral_sgs_parameters.get("hmaj1")
hmin1 = self.lateral_sgs_parameters.get("hmin1")

self.lateral_sgs_variogram = GSLIB.make_variogram(
nugget, nst, it1, cc1, azi1, hmaj1, hmin1
)
Expand Down Expand Up @@ -945,7 +948,6 @@ def build(
self.simulate_growth_thresholds()
self.feature.growth_simulated_thresholds = self.growth_simulated_thresholds
self.feature.lateral_simulated_thresholds = self.lateral_simulated_thresholds


def update(self):
self.build(**self.build_arguments)
Expand Down
13 changes: 7 additions & 6 deletions LoopStructural/modelling/intrusions/intrusion_frame_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
grid_from_array,
shortest_path,
array_from_coords,
find_inout_points
find_inout_points,
)
from LoopStructural.utils import getLogger

Expand All @@ -17,7 +17,10 @@
import skfmm as fmm

except ImportError:
logger.error("skfmm not installed \n" "pip install scikit-fmm")
logger.warning(
"Cannot use IntrusionFrameBuilder: skfmm not installed \n"
"pip install scikit-fmm"
)


class IntrusionFrameBuilder(StructuralFrameBuilder):
Expand Down Expand Up @@ -67,8 +70,8 @@ def __init__(self, interpolator=None, interpolators=None, model=None, **kwargs):
self.intrusion_network_points = None

self.velocity_field_arrays = None
self.IFf = None
self.IFc = None
self.IFf = None
self.IFc = None

def update_geometry(self, points):
self.origin = np.nanmin(np.array([np.min(points, axis=0), self.origin]), axis=0)
Expand Down Expand Up @@ -353,7 +356,6 @@ def indicator_function_contacts(self, delta=None):

delta_list = delta


for i, contact_id in enumerate(sorted(self.anisotropies_series_parameters)):
series_id = self.anisotropies_series_parameters[contact_id][0]
seriesi_mean = self.anisotropies_series_parameters[contact_id][1]
Expand Down Expand Up @@ -509,7 +511,6 @@ def create_intrusion_network(self, **kwargs):

elif self.intrusion_network_type == "shortest path":


grid_points, spacing = self.create_grid_for_indicator_fxs()

# --- check axis
Expand Down

0 comments on commit de22530

Please sign in to comment.