Skip to content

Commit 2b8c647

Browse files
committed
Update rips module, proto files, and Python examples
1 parent fa508d9 commit 2b8c647

File tree

3 files changed

+105
-0
lines changed

3 files changed

+105
-0
lines changed

docs/rips/PythonExamples/wells_and_fractures/modeled_well_path.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@
7979
f"Added diameter roughness intervals: {interval1.start_md}-{interval1.end_md}m and {interval2.start_md}-{interval2.end_md}m"
8080
)
8181

82+
# Add custom segment intervals to define explicit segment boundaries for MSW export
83+
segment1 = completions_settings.add_custom_segment_interval(start_md=3200, end_md=3250)
84+
segment2 = completions_settings.add_custom_segment_interval(start_md=3250, end_md=3320)
85+
segment3 = completions_settings.add_custom_segment_interval(start_md=3320, end_md=3400)
86+
print(
87+
f"Added custom segment intervals: {segment1.start_md}-{segment1.end_md}m, {segment2.start_md}-{segment2.end_md}m, {segment3.start_md}-{segment3.end_md}m"
88+
)
89+
8290
# Optionally update the MSW settings
8391
msw_settings = well_path.msw_settings()
8492
msw_settings.custom_values_for_lateral = False

docs/rips/generated/generated_classes.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2936,6 +2936,19 @@ def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel:
29362936
if WellPathCompletionSettings.__custom_init__ is not None:
29372937
WellPathCompletionSettings.__custom_init__(self, pb2_object=pb2_object, channel=channel)
29382938

2939+
def add_custom_segment_interval(self, start_md: float=0.000000000000000e+00, end_md: float=1.000000000000000e+02) -> CustomSegmentInterval:
2940+
"""
2941+
2942+
2943+
Arguments:
2944+
start_md (float):
2945+
end_md (float):
2946+
Returns:
2947+
CustomSegmentInterval
2948+
"""
2949+
return self._call_pdm_method_return_value("AddCustomSegmentInterval", CustomSegmentInterval, start_md=start_md, end_md=end_md)
2950+
2951+
29392952
def add_diameter_roughness_interval(self, start_md: float=0.000000000000000e+00, end_md: float=1.000000000000000e+02, diameter: float=1.520000000000000e-01, roughness_factor: float=1.000000000000000e-05) -> DiameterRoughnessInterval:
29402953
"""
29412954
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import pytest
2+
3+
import rips
4+
5+
6+
def test_custom_segment_intervals(rips_instance, initialize_test):
7+
"""Test the custom segment intervals Python GRPC interface"""
8+
9+
# Create a test well
10+
well_path_coll = rips_instance.project.well_path_collection()
11+
well_path = well_path_coll.add_new_object(rips.ModeledWellPath)
12+
well_path.name = "Test Well for Custom Segments"
13+
14+
completions_settings = well_path.completion_settings()
15+
assert completions_settings is not None, "Completion settings should not be None"
16+
17+
# Test creating first interval
18+
interval1 = completions_settings.add_custom_segment_interval(
19+
start_md=100, end_md=200
20+
)
21+
22+
# Assertions to verify the first interval
23+
assert interval1 is not None, "First interval should not be None"
24+
assert interval1.start_md == 100
25+
assert interval1.end_md == 200
26+
27+
# Test creating a second interval with different values
28+
interval2 = completions_settings.add_custom_segment_interval(
29+
start_md=250, end_md=350
30+
)
31+
32+
# Assertions to verify the second interval
33+
assert interval2 is not None, "Second interval should not be None"
34+
assert interval2.start_md == 250
35+
assert interval2.end_md == 350
36+
37+
# Test default values
38+
interval3 = completions_settings.add_custom_segment_interval()
39+
40+
assert interval3 is not None, "Third interval with defaults should not be None"
41+
assert interval3.start_md == 0.0
42+
assert interval3.end_md == 100.0
43+
44+
45+
def test_custom_segment_interval_properties(rips_instance, initialize_test):
46+
"""Test modifying custom segment interval properties"""
47+
48+
# Create a test well
49+
well_path_coll = rips_instance.project.well_path_collection()
50+
well_path = well_path_coll.add_new_object(rips.ModeledWellPath)
51+
well_path.name = "Test Well for Property Modification"
52+
53+
completions_settings = well_path.completion_settings()
54+
55+
# Create an interval
56+
interval1 = completions_settings.add_custom_segment_interval(
57+
start_md=100, end_md=200
58+
)
59+
60+
# Test modifying interval properties
61+
interval1.start_md = 150
62+
assert interval1.start_md == 150
63+
64+
interval1.end_md = 250
65+
assert interval1.end_md == 250
66+
67+
68+
def test_custom_segment_interval_invalid_range(rips_instance, initialize_test):
69+
"""Test creating interval with invalid range (start_md > end_md) fails"""
70+
71+
# Create a test well
72+
well_path_coll = rips_instance.project.well_path_collection()
73+
well_path = well_path_coll.add_new_object(rips.ModeledWellPath)
74+
well_path.name = "Test Well for Invalid Range"
75+
76+
completions_settings = well_path.completion_settings()
77+
78+
# Attempt to create an interval with start_md > end_md. Should fail.
79+
with pytest.raises(rips.RipsError, match="End MD must be greater than Start MD"):
80+
completions_settings.add_custom_segment_interval(start_md=200, end_md=100)
81+
82+
# Also test equal values (start_md == end_md), which should also fail
83+
with pytest.raises(rips.RipsError, match="End MD must be greater than Start MD"):
84+
completions_settings.add_custom_segment_interval(start_md=150, end_md=150)

0 commit comments

Comments
 (0)