Skip to content

Commit

Permalink
Merge pull request #26 from jonnymaserati/feature/survey-to-wbp
Browse files Browse the repository at this point in the history
Import and export .wbp files
  • Loading branch information
jonnymaserati committed Dec 21, 2020
2 parents bcdead6 + 2289d2e commit 035dfd6
Show file tree
Hide file tree
Showing 44 changed files with 842 additions and 200 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.venv
.vscode

__pycache__

build
dist
*.egg-info/
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,23 @@
- standard [ISCWSA] method
- new mesh based method using the [Flexible Collision Library]
## New Features!
- **Import from Landmark .wbp files:** using the `exchange.wbp` module it's now possible to import .wbp files exported from Landmark's COMPASS or DecisionSpace software.
```
import welleng as we
wp = we.exchange.wbp.load(demo.wbp) # import file
survey = we.exchange.wbp.wbp_to_survey(wp, step=30) # convert to survey
mesh = we.mesh.WellMesh(survey, method='circle') # convert to mesh
we.visual.plot(m.mesh) # plot the mesh
```
- **Export to .wbp files *(experiemental)*:** using the `exchange.wbp` module, it's possible to convert a planned survey file into a list of turn points that can be exported to a .wbp file.
```
import welleng as we
wp = we.exchange.wbp.WellPlan(survey) # convert Survey to WellPlan object
doc = we.exchange.wbp.export(wp) # create a .wbp document
we.exchange.wbp.save_to_file(doc, f"demo.wbp") # save the document to file
```
- **Well Path Creation:** the addition of the `connector` module enables drilling well paths to be created simply by providing start and end locations (with some vector data like inclination and azimuth). No need to indicate *how* to connect the points, the module will figure that out itself.
- **Fast visualization of well trajectory meshes:** addition of the `visual` module for quick and simple viewing and QAQC of well meshes.
- **Mesh Based Collision Detection:** the current method for determining the Separation Factor between wells is constrained by the frequency and location of survey stations or necessitates interpolation of survey stations in order to determine if Anti-Collision Rules have been violated. Meshing the well bore interpolates between survey stations and as such is a more reliable method for identifying potential well bore collisions, especially wth more sparse data sets.
Expand Down
3 changes: 2 additions & 1 deletion examples/connect_two_random_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@
vec2=vec2,
inc2=inc2,
azi2=azi2,
degrees=True
degrees=True,
min_tangent=0,
)

# Print some pertinent calculation data
Expand Down
Binary file removed welleng/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/clearance.cpython-37.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/clearance.cpython-38.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/connector.cpython-37.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/connector.cpython-38.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/data.cpython-38.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/error.cpython-37.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/error.cpython-38.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/evaluating_clearance.cpython-38.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/import_data.cpython-38.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/io.cpython-37.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/io.cpython-38.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/mesh.cpython-37.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/mesh.cpython-38.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/survey.cpython-37.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/survey.cpython-38.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/target.cpython-37.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/target.cpython-38.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/utils.cpython-37.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/utils.cpython-38.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/version.cpython-37.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/version.cpython-38.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/visual.cpython-37.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/visual.cpython-38.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/well_data.cpython-38.pyc
Binary file not shown.
Binary file removed welleng/__pycache__/well_utils.cpython-38.pyc
Binary file not shown.
49 changes: 37 additions & 12 deletions welleng/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(
degrees=True,
unit='meters',
min_error=1e-5,
delta_radius=10,
delta_radius=20,
min_tangent=10,
max_iterations=1000,
):
Expand Down Expand Up @@ -80,7 +80,7 @@ def __init__(
iteration stops when the desired error tolerance is met. Value
must be less than 1. Use with caution as the code may
become unstable if this value is changed.
delta_radius: float (default: 10)
delta_radius: float (default: 20)
The delta radius (first curve and second curve sections) used
as an iteration stop when balancing radii. If the resulting
delta radius yielded from `dls_design` and `dls_design2` is
Expand Down Expand Up @@ -145,7 +145,10 @@ def __init__(
if md2:
assert not pos2, "Either md2 or pos2"

assert dls_design > 0, "dls_design must be greater than zero"
if dls_design is None:
dls_design = 3.0
else:
assert dls_design > 0, "dls_design must be greater than zero"
assert min_error < 1, "min_error must be less than 1.0"

# figure out what method is required to connect the points
Expand Down Expand Up @@ -369,6 +372,7 @@ def _get_method(self):

def _get_initial_methods(self):
# TODO: probably better to load this in from a yaml file
# [md2, inc2, azi2, pos2, vec2] forms the booleans
self.initial_methods = {
'00000': 'no_input',
'00001': 'min_curve_or_hold',
Expand Down Expand Up @@ -398,7 +402,7 @@ def _get_initial_methods(self):
'11001': 'vec_and_inc_azi',
'11010': 'md_and_pos',
'11011': 'md_and_pos',
'11100': 'min_curve',
'11100': 'min_curve_or_hold',
'11101': 'vec_and_inc_azi',
'11110': 'md_and_pos',
'11111': 'md_and_pos'
Expand Down Expand Up @@ -569,7 +573,11 @@ def _target_pos_and_vec_defined(self, pos3, vec_old=[0,0,0]):
)
)

self.vec23.append((self.pos3 - self.pos2) / np.linalg.norm(self.pos3 - self.pos2))
vec23_denom = np.linalg.norm(self.pos3 - self.pos2)
if vec23_denom == 0:
self.vec23.append(np.array([0,0,0]))
else:
self.vec23.append((self.pos3 - self.pos2) / vec23_denom)

self.error = np.allclose(
self.vec23[-1],
Expand Down Expand Up @@ -761,6 +769,9 @@ def get_vec_target(
dist_curve,
func_dogleg
):
if dist_curve == 0:
return vec1

vec_target = (
(
pos_target - pos1 - (
Expand Down Expand Up @@ -798,7 +809,10 @@ def shape_factor(dogleg):
dogleg: float
The dogleg angle in radians of a curve section.
"""
return np.tan(dogleg / 2) / (dogleg / 2)
if dogleg == 0:
return 0
else:
return np.tan(dogleg / 2) / (dogleg / 2)

def min_dist_to_target(radius, distances):
"""
Expand Down Expand Up @@ -867,6 +881,11 @@ def get_radius_critical(radius, distances, min_error):
dist_norm_to_target
) = distances

### NEW ###
if dist_norm_to_target == 0:
return 0
### END ###

radius_critical = (
dist_to_target ** 2 / (
2 * dist_norm_to_target
Expand Down Expand Up @@ -973,10 +992,13 @@ def get_survey(section_data, start_nev=[0,0,0], radius=10):
return survey

def interpolate_curve(md1, pos1, vec1, vec2, dist_curve, dogleg, func_dogleg, step, endpoint=False):
start_md = step - (md1 % step)
end_md = abs(dist_curve)
md = np.arange(start_md, end_md, step)
md = np.concatenate(([0.], md))
if step is None:
md = np.array([0])
else:
start_md = step - (md1 % step)
md = np.arange(start_md, end_md, step)
md = np.concatenate(([0.], md))
if endpoint:
md = np.concatenate((md, [end_md]))
dogleg_interp = (dogleg / dist_curve * md).reshape(-1,1)
Expand Down Expand Up @@ -1006,10 +1028,13 @@ def interpolate_curve(md1, pos1, vec1, vec2, dist_curve, dogleg, func_dogleg, st
return data

def interpolate_hold(md1, pos1, vec1, md2, step, endpoint=False):
start_md = step - (md1 % step)
end_md = md2 - md1
md = np.arange(start_md, end_md, step)
md = np.concatenate(([0.], md))
if step is None:
md = np.array([0])
else:
start_md = step - (md1 % step)
md = np.arange(start_md, end_md, step)
md = np.concatenate(([0.], md))
if endpoint:
md = np.concatenate((md, [end_md]))
vec = np.full((len(md),3), vec1)
Expand Down
Binary file removed welleng/errors/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file removed welleng/errors/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file removed welleng/errors/__pycache__/iscwsa_mwd.cpython-37.pyc
Binary file not shown.
Binary file removed welleng/errors/__pycache__/iscwsa_mwd.cpython-38.pyc
Binary file not shown.
Binary file removed welleng/exchange/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file removed welleng/exchange/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file removed welleng/exchange/__pycache__/wbp.cpython-37.pyc
Binary file not shown.
Binary file removed welleng/exchange/__pycache__/wbp.cpython-38.pyc
Binary file not shown.
Loading

0 comments on commit 035dfd6

Please sign in to comment.