Skip to content

Commit 7a9d39f

Browse files
Merge branch 'develop' into 'master'
0.5.1 Develop to Master See merge request SOLO-band/python-sdk!94
2 parents 26b83c5 + 7399edc commit 7a9d39f

File tree

2 files changed

+34
-20
lines changed

2 files changed

+34
-20
lines changed

src/rogii_solo/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '0.5.0' # Must be at the top of module
1+
__version__ = '0.5.1' # Must be at the top of module
22

33
from rogii_solo.client import SoloClient
44

src/rogii_solo/interpretation.py

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,24 @@ def _get_fitted_segments(
213213
)
214214
)
215215
else:
216-
nearest_left_point, nearest_right_point = get_nearest_values(
216+
nearest_points = get_nearest_values(
217217
value=left_segment['md'], input_list=calculated_trajectory, key=lambda it: it['md']
218218
)
219-
interpolated_point = interpolate_trajectory_point(
220-
left_point=nearest_left_point,
221-
right_point=nearest_right_point,
222-
md=left_segment['md'],
223-
well=well,
224-
measure_units=measure_units,
225-
)
219+
220+
if len(nearest_points) < 2:
221+
# Interpretation start MD = calculated trajectory start MD
222+
# Otherwise (MD approximately equal or equal the last trajectory point MD) two points are found
223+
interpolated_point = calculated_trajectory[0]
224+
else:
225+
nearest_left_point, nearest_right_point = nearest_points
226+
interpolated_point = interpolate_trajectory_point(
227+
left_point=nearest_left_point,
228+
right_point=nearest_right_point,
229+
md=left_segment['md'],
230+
well=well,
231+
measure_units=measure_units,
232+
)
233+
226234
left_segment['vs'] = interpolated_point['vs']
227235
fitted_segments.append(left_segment)
228236

@@ -235,17 +243,23 @@ def _get_truncated_segment(
235243
segment_vs_length = calc_segment_vs_length(
236244
x1=left['x'], y1=left['y'], x2=right['x'], y2=right['y'], azimuth_vs=well['azimuth']
237245
)
238-
nearest_left_point, nearest_right_point = get_nearest_values(
239-
value=left['md'], input_list=trajectory, key=lambda it: it['md']
240-
)
241-
left_point = interpolate_trajectory_point(
242-
left_point=nearest_left_point,
243-
right_point=nearest_right_point,
244-
md=left['md'],
245-
well=well,
246-
measure_units=measure_units,
247-
)
248-
left_point_vs = left_point['vs']
246+
nearest_points = get_nearest_values(value=left['md'], input_list=trajectory, key=lambda it: it['md'])
247+
248+
if len(nearest_points) < 2:
249+
# Interpretation start MD = calculated trajectory start MD
250+
# Otherwise (MD approximately equal or equal the last trajectory point MD) two points are found
251+
interpolated_point = trajectory[0]
252+
else:
253+
nearest_left_point, nearest_right_point = nearest_points
254+
interpolated_point = interpolate_trajectory_point(
255+
left_point=nearest_left_point,
256+
right_point=nearest_right_point,
257+
md=left['md'],
258+
well=well,
259+
measure_units=measure_units,
260+
)
261+
262+
left_point_vs = interpolated_point['vs']
249263
right_point_vs = trajectory[-1]['vs']
250264

251265
truncated_segment_vs_length = fabs(right_point_vs - left_point_vs)

0 commit comments

Comments
 (0)