Skip to content

Commit c690901

Browse files
committed
Update rips module and Python examples
1 parent 8655506 commit c690901

File tree

7 files changed

+814
-2
lines changed

7 files changed

+814
-2
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
"""
2+
Example: Import Well Log Data to Well Paths
3+
4+
This example demonstrates how to import well log data with measured depth
5+
and multiple channels from Python arrays into ResInsight well paths using
6+
the new well log import API.
7+
"""
8+
9+
import rips
10+
11+
12+
def create_example_well_log_data():
13+
"""Create example well log data with measured depth and multiple channels"""
14+
# Measured depth values in meters
15+
measured_depth = [1000, 1200, 1400, 1600, 1800, 2000, 2200, 2400, 2600, 2800]
16+
17+
# Multiple channel data corresponding to each measured depth
18+
channel_data = {
19+
"gamma_ray": [75.2, 82.1, 78.5, 80.3, 85.7, 88.2, 90.1, 87.3, 84.6, 82.8],
20+
"porosity": [0.12, 0.15, 0.18, 0.22, 0.25, 0.28, 0.24, 0.20, 0.16, 0.14],
21+
"permeability": [15.5, 22.3, 35.8, 48.2, 65.1, 78.4, 52.9, 38.7, 25.6, 18.9],
22+
"resistivity": [2.1, 1.8, 3.2, 2.5, 1.9, 1.4, 2.8, 3.1, 2.7, 2.3],
23+
}
24+
25+
return measured_depth, channel_data
26+
27+
28+
def main():
29+
# Connect to ResInsight
30+
resinsight = rips.Instance.find()
31+
project = resinsight.project
32+
33+
# Create a well path from coordinates
34+
coordinates = [
35+
[458000, 5934000, -1000], # X, Y, Z coordinates
36+
[458100, 5934100, -1500],
37+
[458200, 5934200, -2000],
38+
[458300, 5934300, -2500],
39+
[458400, 5934400, -3000],
40+
]
41+
42+
well_path = project.well_path_collection().import_well_path_from_points(
43+
name="ExampleWell", coordinates=coordinates
44+
)
45+
46+
print(f"Created well path: {well_path.name}")
47+
48+
# Get example well log data
49+
measured_depth, channel_data = create_example_well_log_data()
50+
51+
# Import well log with multiple channels using the new API
52+
well_log = well_path.add_well_log(
53+
name="ComprehensiveWellLog",
54+
measured_depth=measured_depth,
55+
channel_data=channel_data,
56+
)
57+
58+
print(f"Added well log: {well_log.name}")
59+
print(
60+
f" - Measured depth range: {min(measured_depth):.1f} - {max(measured_depth):.1f} m"
61+
)
62+
print(f" - Number of data points: {len(measured_depth)}")
63+
print(f" - Channels imported: {', '.join(channel_data.keys())}")
64+
65+
# You can also import additional well logs with different data
66+
# For example, a well log with different measured depth intervals
67+
additional_measured_depth = [1100, 1300, 1500, 1700, 1900, 2100, 2300, 2500, 2700]
68+
additional_channel_data = {
69+
"caliper": [8.5, 8.2, 8.7, 8.3, 8.1, 8.4, 8.6, 8.2, 8.3],
70+
"neutron": [0.18, 0.22, 0.25, 0.28, 0.31, 0.29, 0.26, 0.23, 0.20],
71+
}
72+
73+
additional_well_log = well_path.add_well_log(
74+
name="AdditionalWellLog",
75+
measured_depth=additional_measured_depth,
76+
channel_data=additional_channel_data,
77+
)
78+
79+
print(f"Added additional well log: {additional_well_log.name}")
80+
print(
81+
f" - MD range: {min(additional_measured_depth):.1f} - {max(additional_measured_depth):.1f} m"
82+
)
83+
print(f" - Channels imported: {', '.join(additional_channel_data.keys())}")
84+
85+
86+
if __name__ == "__main__":
87+
main()

docs/rips/generated/RiaVersionInfo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818

1919
RESINSIGHT_MAJOR_VERSION : str = "2025"
2020
RESINSIGHT_MINOR_VERSION : str = "09"
21-
RESINSIGHT_PATCH_VERSION : str = "1"
21+
RESINSIGHT_PATCH_VERSION : str = "2"
2222

2323
PYTHON_GRPC_PROTOC_VERSION : str = "libprotoc 26.1"

docs/rips/generated/generated_classes.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,29 @@ def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel:
942942
if HistogramPlot.__custom_init__ is not None:
943943
HistogramPlot.__custom_init__(self, pb2_object=pb2_object, channel=channel)
944944

945+
class WellLog(PdmObjectBase):
946+
__custom_init__ = None #: Assign a custom init routine to be run at __init__
947+
948+
def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel: Optional[grpc.Channel]=None) -> None:
949+
PdmObjectBase.__init__(self, pb2_object, channel)
950+
if WellLog.__custom_init__ is not None:
951+
WellLog.__custom_init__(self, pb2_object=pb2_object, channel=channel)
952+
953+
class ImportedWellLog(WellLog):
954+
"""
955+
ImportedWellLog
956+
957+
Attributes:
958+
name (str): Name
959+
"""
960+
__custom_init__ = None #: Assign a custom init routine to be run at __init__
961+
962+
def __init__(self, pb2_object: Optional[PdmObject_pb2.PdmObject]=None, channel: Optional[grpc.Channel]=None) -> None:
963+
self.name: str = ""
964+
WellLog.__init__(self, pb2_object, channel)
965+
if ImportedWellLog.__custom_init__ is not None:
966+
ImportedWellLog.__custom_init__(self, pb2_object=pb2_object, channel=channel)
967+
945968
class IntersectionCollection(PdmObjectBase):
946969
__custom_init__ = None #: Assign a custom init routine to be run at __init__
947970

@@ -994,6 +1017,22 @@ def add_thermal_fracture(self, measured_depth: float=0.000000000000000e+00, frac
9941017
return self._call_pdm_method_return_value("AddThermalFracture", WellPathFracture, measured_depth=measured_depth, fracture_template=fracture_template, place_using_template_data=place_using_template_data)
9951018

9961019

1020+
def add_well_log_internal(self, name: str="", measured_depth_key: str="", channel_keys_csv: str="", tvd_msl_key: str="", tvd_rkb_key: str="") -> ImportedWellLog:
1021+
"""
1022+
Add Well Log
1023+
1024+
Arguments:
1025+
name (str):
1026+
measured_depth_key (str):
1027+
channel_keys_csv (str):
1028+
tvd_msl_key (str):
1029+
tvd_rkb_key (str):
1030+
Returns:
1031+
ImportedWellLog
1032+
"""
1033+
return self._call_pdm_method_return_value("AddWellLogInternal", ImportedWellLog, name=name, measured_depth_key=measured_depth_key, channel_keys_csv=channel_keys_csv, tvd_msl_key=tvd_msl_key, tvd_rkb_key=tvd_rkb_key)
1034+
1035+
9971036
def append_fishbones(self, sub_locations: List[float]=[], drilling_type: str="STANDARD") -> Optional[Fishbones]:
9981037
"""
9991038
Append Fishbones
@@ -3086,6 +3125,7 @@ def class_dict() -> Dict[str, Type[PdmObjectBase]]:
30863125
classes['GridCaseSurface'] = GridCaseSurface
30873126
classes['GridSummaryCase'] = GridSummaryCase
30883127
classes['HistogramPlot'] = HistogramPlot
3128+
classes['ImportedWellLog'] = ImportedWellLog
30893129
classes['IntersectionCollection'] = IntersectionCollection
30903130
classes['MeshFractureTemplate'] = MeshFractureTemplate
30913131
classes['ModeledWellPath'] = ModeledWellPath
@@ -3138,6 +3178,7 @@ def class_dict() -> Dict[str, Type[PdmObjectBase]]:
31383178
classes['ViewWindow'] = ViewWindow
31393179
classes['WbsParameters'] = WbsParameters
31403180
classes['WellBoreStabilityPlot'] = WellBoreStabilityPlot
3181+
classes['WellLog'] = WellLog
31413182
classes['WellLogExtractionCurve'] = WellLogExtractionCurve
31423183
classes['WellLogPlot'] = WellLogPlot
31433184
classes['WellLogPlotCollection'] = WellLogPlotCollection

0 commit comments

Comments
 (0)