Skip to content

Commit

Permalink
fix: extra checks
Browse files Browse the repository at this point in the history
some extra checks when resizing support.
Avoiding nan problems
  • Loading branch information
Lachlan Grose committed Feb 1, 2022
1 parent 7907f58 commit ba6f391
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions LoopStructural/interpolators/base_structured_3d_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ def __str__(self):
@property
def nodes(self):
max = self.origin + self.nsteps_cells * self.step_vector
if np.any(np.isnan(self.nsteps)):
raise ValueError("Cannot resize mesh nsteps is NaN")
if np.any(np.isnan(self.origin)):
raise ValueError("Cannot resize mesh origin is NaN")

x = np.linspace(self.origin[0], max[0], self.nsteps[0])
y = np.linspace(self.origin[1], max[1], self.nsteps[1])
z = np.linspace(self.origin[2], max[2], self.nsteps[2])
Expand Down
3 changes: 3 additions & 0 deletions LoopStructural/modelling/core/geological_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,9 @@ def create_and_add_fault(
**kwargs,
}
)
if displacement == 0:
logger.warning(f"{fault_surface_data} displacement is 0")

if "data_region" in kwargs:
kwargs.pop("data_region")
logger.error("kwarg data_region currently not supported, disabling")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,14 @@ def set_interpolation_geometry(self, origin, maximum, rotation=None):
"""
logger.info(f"Setting mesh origin: {origin[0]} {origin[1]} {origin[2]} ")
logger.info(f"Setting mesh maximum: {maximum[0]} {maximum[1]} {maximum[2]}")
if np.any(np.isnan(origin)):
logger.warning("Origin is NaN, not updating")
return

if np.any(np.isnan(maximum)):
logger.warning("Maximum is NaN, not updating")
return

self.interpolator.support.origin = origin
self.interpolator.support.maximum = maximum
self.interpolator.support.rotation_xy = rotation
Expand Down

0 comments on commit ba6f391

Please sign in to comment.