GEOPY-2108: Support 3D vector property group for orientation of rotated gradients#123
GEOPY-2108: Support 3D vector property group for orientation of rotated gradients#123domfournier merged 7 commits intodevelopfrom
Conversation
…wrap inside a cartesian_to_direction_and_dip.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #123 +/- ##
===========================================
+ Coverage 81.01% 82.50% +1.48%
===========================================
Files 13 13
Lines 669 720 +51
Branches 94 94
===========================================
+ Hits 542 594 +52
Misses 105 105
+ Partials 22 21 -1
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Here's a simple test to check against
from geoh5py.objects import Points
from geoh5py import Workspace
from geoh5py.groups.property_group import GroupTypeEnum
def test_spherical_values(tmp_path):
theta, phi = np.meshgrid(np.arange(0, 360, 10), np.arange(-90, 90, 10))
theta = theta.flatten()
phi = phi.flatten()
rad = 100.0
x = rad * np.cos(np.radians(theta)) * np.cos(np.radians(phi))
y = rad * np.sin(np.radians(theta)) * np.cos(np.radians(phi))
z = rad * np.sin(np.radians(phi))
angles = np.rad2deg(cartesian_to_spherical(np.c_[x, y, z]))
with Workspace.create(tmp_path / f"{__name__}.geoh5") as workspace:
points = Points.create(
workspace,
name="spherical_points",
vertices=np.c_[x, y, z],
)
unit_xyz = points.add_data({
"x": {"values": x / rad},
"y": {"values": y / rad},
"z": {"values": z / rad},
})
prop_group = points.create_property_group(
name="direction_xyz",
properties=unit_xyz,
property_group_type=GroupTypeEnum.VECTOR,
)
dip_azm = points.add_data({
"dip": {"values": angles[:, 1]},
"azimuth": {"values": angles[:, 0]},
}
)
prop_group = points.create_property_group(
name="direction_dip_azm",
properties=dip_azm,
property_group_type=GroupTypeEnum.DIPDIR,
)
We should expect the orientation VECTOR and DIPDIR to be perpendicular arrows everywhere, which is currently not the case.
Also, the current dip is positive upward, which is opposite of the convention (positive down).
You could tackle this by
1- converting the normalized xyz vector to its corresponding theta and phi
2- rotate a unit y vector [0, 1, 0] with the same angles
2- convert that new rotated vector to [theta, phi] -> [azimuth dip]
|
Code Climate has analyzed commit 487c215 and detected 0 issues on this pull request. View more on Code Climate. |


GEOPY-2108 - Support 3D vector property group for orientation of rotated gradients
…wrap inside a cartesian_to_direction_and_dip.