Skip to content

Commit 1ce2606

Browse files
committed
Update to confine the 3d vector conversions to direction and dip within th eastern hemisphere
1 parent 1c9c9fd commit 1ce2606

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

simpeg_drivers/utils/regularization.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
import numpy as np
1212
import scipy.sparse as ssp
1313
from discretize import TreeMesh
14+
from geoapps_utils.utils.transformations import normal_to_direction_and_dip
1415
from geoh5py.groups import PropertyGroup
1516
from geoh5py.groups.property_group_type import GroupTypeEnum
1617
from simpeg.regularization import SparseSmoothness
1718
from simpeg.utils import mkvc, sdiag
18-
from simpeg.utils.mat_utils import cartesian2amplitude_dip_azimuth
1919

2020

2121
def cell_neighbors_along_axis(mesh: TreeMesh, axis: str) -> np.ndarray:
@@ -408,10 +408,7 @@ def ensure_dip_direction_convention(
408408
"""
409409

410410
if group_type == GroupTypeEnum.VECTOR:
411-
orientations = orientations / np.c_[np.linalg.norm(orientations, axis=1)]
412-
dip, direction = cartesian2amplitude_dip_azimuth(orientations)[:, 1:].T
413-
dip += 90.0
414-
orientations = np.c_[direction, dip]
411+
orientations = np.rad2deg(normal_to_direction_and_dip(orientations))
415412

416413
if group_type in [GroupTypeEnum.STRIKEDIP]:
417414
orientations[:, 0] = 90.0 + orientations[:, 0]

tests/utils_regularization_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,5 +132,5 @@ def test_ensure_dip_direction_convention():
132132
]
133133
)
134134
dir_dip = ensure_dip_direction_convention(orientations, group_type="3D vector")
135-
assert np.allclose(dir_dip[:, 0], [90, 0, 270, 180] * 2 + [254])
136-
assert np.allclose(dir_dip[:, 1], [45] * 4 + [30] * 4 + [37])
135+
assert np.allclose(dir_dip[:, 0], [90, 0, 90, 180] * 2 + [74])
136+
assert np.allclose(dir_dip[:, 1], [45] * 4 + [30] * 4 + [-37])

0 commit comments

Comments
 (0)