mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4550 Implement python well methods
This commit is contained in:
parent
12a0a8c358
commit
2788c7a6c1
@ -227,4 +227,4 @@ list ( APPEND GRPC_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
|
|||||||
list ( APPEND GRPC_CPP_SOURCES ${SOURCE_GROUP_SOURCE_FILES})
|
list ( APPEND GRPC_CPP_SOURCES ${SOURCE_GROUP_SOURCE_FILES})
|
||||||
|
|
||||||
source_group( "GrpcInterface" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.cmake )
|
source_group( "GrpcInterface" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.cmake )
|
||||||
source_group( "GrpcInterface\\GrpcProtos" FILES ${GRPC_PROTO_FILES_FULL_PATH} )
|
source_group( "GrpcInterface\\GrpcProtos" FILES ${GRPC_PROTO_FILES_FULL_PATH} )
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
###################################################################################
|
||||||
|
# This example will connect to ResInsight, retrieve a list of wells and print info
|
||||||
|
#
|
||||||
|
###################################################################################
|
||||||
|
|
||||||
|
# Import the ResInsight Processing Server Module
|
||||||
|
import rips
|
||||||
|
|
||||||
|
# Connect to ResInsight
|
||||||
|
resinsight = rips.Instance.find()
|
||||||
|
if resinsight is not None:
|
||||||
|
# Get a list of all wells
|
||||||
|
wells = resinsight.project.wells()
|
||||||
|
|
||||||
|
print ("Got " + str(len(wells)) + " wells: ")
|
||||||
|
for well in wells:
|
||||||
|
print("Well name: " + well.name)
|
@ -10,6 +10,7 @@ from rips.gridcasegroup import GridCaseGroup
|
|||||||
from rips.pdmobject import PdmObject
|
from rips.pdmobject import PdmObject
|
||||||
from rips.plot import Plot
|
from rips.plot import Plot
|
||||||
from rips.view import View
|
from rips.view import View
|
||||||
|
from rips.well import Well
|
||||||
from rips.contour_map import ContourMap, ContourMapType
|
from rips.contour_map import ContourMap, ContourMapType
|
||||||
|
|
||||||
import rips.generated.Commands_pb2 as Cmd
|
import rips.generated.Commands_pb2 as Cmd
|
||||||
@ -298,6 +299,19 @@ class Project(PdmObject):
|
|||||||
wellPathFiles=well_path_files))
|
wellPathFiles=well_path_files))
|
||||||
return res.importWellPathsResult.wellPathNames
|
return res.importWellPathsResult.wellPathNames
|
||||||
|
|
||||||
|
def wells(self):
|
||||||
|
"""Get a list of all wells in the project
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
A list of rips Well objects
|
||||||
|
"""
|
||||||
|
pdm_objects = self.descendants("WellPathBase")
|
||||||
|
wells = []
|
||||||
|
for pdm_object in pdm_objects:
|
||||||
|
wells.append(Well(pdm_object.get_value("WellPathName"), pdm_object))
|
||||||
|
return wells
|
||||||
|
|
||||||
|
|
||||||
def import_well_log_files(self, well_log_files=None, well_log_folder=''):
|
def import_well_log_files(self, well_log_files=None, well_log_folder=''):
|
||||||
""" Import well log files into project
|
""" Import well log files into project
|
||||||
|
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
sys.path.insert(1, os.path.join(sys.path[0], '../../'))
|
||||||
|
import rips
|
||||||
|
|
||||||
|
import dataroot
|
||||||
|
|
||||||
|
def test_10k(rips_instance, initialize_test):
|
||||||
|
case_root_path = dataroot.PATH + "/TEST10K_FLT_LGR_NNC"
|
||||||
|
case_path = case_root_path + "/TEST10K_FLT_LGR_NNC.EGRID"
|
||||||
|
case = rips_instance.project.load_case(path=case_path)
|
||||||
|
assert(len(case.grids()) == 2)
|
||||||
|
well_path_files = [case_root_path + "/wellpath_a.dev", case_root_path + "/wellpath_b.dev"]
|
||||||
|
well_paths = rips_instance.project.import_well_paths(well_path_files)
|
||||||
|
wells = rips_instance.project.wells()
|
||||||
|
assert(len(wells) == 2)
|
||||||
|
assert(wells[0].name == "Well Path A")
|
||||||
|
assert(wells[1].name == "Well Path B")
|
17
ApplicationCode/GrpcInterface/Python/rips/well.py
Normal file
17
ApplicationCode/GrpcInterface/Python/rips/well.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
"""
|
||||||
|
ResInsight Well
|
||||||
|
"""
|
||||||
|
import rips.generated.Commands_pb2 as Cmd
|
||||||
|
|
||||||
|
from rips.pdmobject import PdmObject
|
||||||
|
|
||||||
|
class Well(PdmObject):
|
||||||
|
"""ResInsight well class
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
name(string): Name of the well.
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __init__(self, name, pdm_object):
|
||||||
|
PdmObject.__init__(self, pdm_object.pb2_object(), pdm_object.channel(), pdm_object.project())
|
||||||
|
self.name = name
|
Loading…
Reference in New Issue
Block a user