ResInsight/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/create_wbs_plot.py

43 lines
1.3 KiB
Python
Raw Normal View History

import os
import grpc
# Load ResInsight Processing Server Client Library
import rips
# Connect to ResInsight instance
resInsight = rips.Instance.find()
2020-03-03 03:43:07 -06:00
# Get all GeoMech cases
cases = resInsight.project.descendants(rips.GeoMechCase)
2020-03-03 03:43:07 -06:00
# Get all well paths
well_paths = resInsight.project.well_paths()
2020-03-03 03:43:07 -06:00
# Ensure there's at least one well path
if len(well_paths) < 1:
print("No well paths in project")
exit(1)
# Create a set of WbsParameters
params = rips.WbsParameters()
params.user_poisson_ratio = 0.23456
params.user_ucs = 123
2020-03-03 03:43:07 -06:00
# Loop through all cases
for case in cases:
2020-03-03 03:43:07 -06:00
assert(isinstance(case, rips.GeoMechCase))
min_res_depth, max_res_depth = case.reservoir_depth_range()
# Find a good output path
case_path = case.file_path
folder_name = os.path.dirname(case_path)
2020-03-03 03:43:07 -06:00
# Import formation names
case.import_formation_names(formation_files=['D:/Projects/ResInsight-regression-test/ModelData/norne/Norne_ATW2013.lyr'])
2020-03-03 03:43:07 -06:00
# create a folder to hold the snapshots
dirname = os.path.join(folder_name, 'snapshots')
print("Exporting to: " + dirname)
2020-03-03 03:43:07 -06:00
for well_path in well_paths[0:4]: # Loop through the first five well paths
# Create plot with parameters
wbsplot = case.create_well_bore_stability_plot(well_path=well_path.name, time_step=0, parameters=params)