Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for wellpathpy for minimum curvature desurvey #516

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions geoh5py/objects/drillhole.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,42 @@ def desurvey(self, depths):
if isinstance(depths, list):
depths = np.asarray(depths)

surveys = self.surveys.copy()

# Repeat first survey point at surface for de-survey interpolation
surveys = np.vstack([self.surveys[0, :], self.surveys])
surveys[0, 0] = 0.0
# (only if needed)
if surveys[0, 0] != 0.0:
surveys = np.vstack([surveys[0, :], surveys])
surveys[0, 0] = 0.0

try:
import wellpathpy as wp

# Repeat last survey point at bottom depth of desurvey request
# TODO there is a mathematically more correct way to do this.
if surveys[-1, 0] < depths[-1]:
surveys = np.vstack([surveys, surveys[-1, :]])
surveys[-1, 0] = depths[-1]

# geoh5py dips range from -90 to 0
# wellpathpy expects inclination inc | 0 <= inc < 180
# where 180 = 90 degree dip (vertical), so never truly vertical?
surveys[:, 2] = surveys[:, 2] + 90.00000000001

dev = wp.deviation(md=surveys[:, 0], azi=surveys[:, 1], inc=surveys[:, 2])
pos = dev.minimum_curvature().resample(depths)

return np.c_[
[
self.locations[0, 0] + pos.easting,
self.locations[0, 1] + pos.northing,
self.locations[0, 2] - pos.depth,
]
].T
except Exception as e:
print("cannot do wellpathpy")
print(e)


ind_loc = np.maximum(
np.searchsorted(surveys[:, 0], depths, side="left") - 1,
Expand Down
Loading