Skip to content

Commit 07b6078

Browse files
committed
fix: adding method to evaluate all stratigraphic feature gradients.
Effectively, looks through stratigraphic column
1 parent ae5324a commit 07b6078

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

LoopStructural/interpolators/supports/_2d_base_unstructured.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@ def get_element_for_location(
280280
npts_step = int(1e4)
281281
# break into blocks of 10k points
282282
while npts < points.shape[0]:
283-
print(npts, npts_step, points.shape[0])
284283
cell_index, inside = self.aabb_grid.position_to_cell_index(
285284
points[: npts + npts_step, :]
286285
)

LoopStructural/modelling/core/geological_model.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,6 +1558,38 @@ def evaluate_model(self, xyz: np.ndarray, scale: bool = True) -> np.ndarray:
15581558
logger.error(f"Model does not contain {group}")
15591559
return strat_id
15601560

1561+
def evaluate_model_gradient(self, points: np.ndarray, scale: bool = True) -> np.ndarray:
1562+
"""Evaluate the gradient of the stratigraphic column at each location
1563+
1564+
Parameters
1565+
----------
1566+
points : np.ndarray
1567+
location to evaluate
1568+
scale : bool, optional
1569+
whether to scale the points into model domain, by default True
1570+
1571+
Returns
1572+
-------
1573+
np.ndarray
1574+
N,3 array of gradient vectors
1575+
"""
1576+
xyz = np.array(points)
1577+
if scale:
1578+
xyz = self.scale(xyz, inplace=False)
1579+
grad = np.zeros(xyz.shape)
1580+
for group in reversed(self.stratigraphic_column.keys()):
1581+
if group == "faults":
1582+
continue
1583+
feature_id = self.feature_name_index.get(group, -1)
1584+
if feature_id >= 0:
1585+
feature = self.features[feature_id]
1586+
gradt = feature.evaluate_gradient(xyz)
1587+
grad[~np.isnan(gradt).any(axis=1)] = gradt[~np.isnan(gradt).any(axis=1)]
1588+
if feature_id == -1:
1589+
logger.error(f"Model does not contain {group}")
1590+
1591+
return grad
1592+
15611593
def evaluate_fault_displacements(self, points, scale=True):
15621594
"""Evaluate the fault displacement magnitude at each location
15631595

0 commit comments

Comments
 (0)