|
| 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() |
0 commit comments