Simplify Python API

This commit is contained in:
Gaute Lindkvist 2020-03-04 15:11:24 +01:00
parent bd8e079e24
commit c23e27eef0
7 changed files with 9 additions and 62 deletions

View File

@ -13,6 +13,6 @@ from rips.project import Project
from rips.plot import Plot, PlotWindow
from rips.contour_map import EclipseContourMap, GeoMechContourMap
from rips.well_log_plot import WellLogPlot
from rips.well_bore_stability_plot import WellBoreStabilityPlot, WbsParameters
from rips.simulation_well import SimulationWell
from rips.wellpath import WellPathBase
from rips.generated.pdm_objects import *

View File

@ -26,7 +26,7 @@ import rips.project
from rips.grid import Grid
from rips.pdmobject import add_method, PdmObject
from rips.view import View
from rips.well_bore_stability_plot import WellBoreStabilityPlot, WbsParameters
from rips.generated.pdm_objects import WellBoreStabilityPlot, WbsParameters
from rips.simulation_well import SimulationWell
"""ResInsight case class

View File

@ -11,14 +11,13 @@ from rips.gridcasegroup import GridCaseGroup
from rips.pdmobject import PdmObject, add_method, add_static_method
from rips.plot import Plot
from rips.view import View
from rips.wellpath import WellPathBase
import rips.generated.Commands_pb2 as Cmd
from rips.generated.Definitions_pb2 import Empty
import rips.generated.Project_pb2_grpc as Project_pb2_grpc
import rips.generated.Project_pb2 as Project_pb2
import rips.generated.PdmObject_pb2 as PdmObject_pb2
from rips.generated.pdm_objects import Project, PlotWindow
from rips.generated.pdm_objects import Project, PlotWindow, WellPath
@add_method(Project)
@ -277,7 +276,7 @@ def import_well_paths(self, well_path_files=None, well_path_folder=''):
well_path_folder(str): A folder path containing files to import
Returns:
A list of WellPathBase objects
A list of WellPath objects
"""
if well_path_files is None:
well_path_files = []
@ -294,16 +293,16 @@ def well_paths(self):
"""Get a list of all well paths in the project
Returns:
A list of rips WellPathBase objects
A list of rips WellPath objects
"""
return self.descendants(WellPathBase)
return self.descendants(WellPath)
@add_method(Project)
def well_path_by_name(self, well_path_name):
"""Get a specific well path by name from the project
Returns:
A WellPathBase object
A WellPath object
"""
all_well_paths = self.well_paths()
for well_path in all_well_paths:

View File

@ -9,19 +9,6 @@ import rips.case # Circular import of Case, which already imports View. Use ful
from rips.pdmobject import add_method
from rips.generated.pdm_objects import View, ViewWindow, EclipseView, GeoMechView
@add_method(View)
def is_eclipse_view(self):
return isinstance(self, EclipseView)
@add_method(View)
def is_geomech_view(self):
return isinstance(self, GeoMechView)
@add_method(View)
def cell_result(self):
"""Retrieve the current cell results"""
return self.children("GridCellResult")[0]
@add_method(View)
def apply_cell_result(self, result_type, result_variable):
"""Apply a regular cell result

View File

@ -1,33 +0,0 @@
"""
ResInsight Well Bore Stability Plot module
"""
from rips.pdmobject import PdmObject, add_method
from rips.well_log_plot import WellLogPlot
from rips.generated.pdm_objects import WellBoreStabilityPlot, WbsParameters
@add_method(WbsParameters)
def __custom_init__(self, pb2_object=None, channel=None):
self.pore_pressure_reservoir_source = "UNDEFINED"
self.pore_pressure_non_reservoir_source = "UNDEFINED"
self.poisson_ratio_source = "UNDEFINED"
self.ucs_source = "UNDEFINED"
self.obg0_source = "UNDEFINED"
self.df_source = "UNDEFINED"
self.k0sh_source = "UNDEFINED"
self.fg_shale_source = "UNDEFINED"
self.k0fg_source = "UNDEFINED"
self.user_pp_non_reservoir = 1.05
self.user_poission_ratio = 0.35
self.user_ucs = 100
self.user_df = 0.7
self.user_k0sh = 0.65
self.fg_multiplier = 1.05
self.user_k0fg = 0.75
@add_method(WellBoreStabilityPlot)
def set_parameters(self, new_parameters):
current_params = self.parameters()
current_params.copy_from(new_parameters)

View File

@ -1,6 +0,0 @@
"""
ResInsight Well
"""
import rips.generated.Commands_pb2 as Cmd
from rips.generated.pdm_objects import WellPathBase

View File

@ -73,7 +73,7 @@ const char RimWellPath::SIM_WELL_NONE_UI_TEXT[] = "None";
//--------------------------------------------------------------------------------------------------
RimWellPath::RimWellPath()
{
CAF_PDM_InitScriptableObject( "WellPath", ":/Well.png", "", "The Base class for Well Paths" );
CAF_PDM_InitScriptableObjectWithNameAndComment( "WellPath", ":/Well.png", "", "", "WellPath", "The Base class for Well Paths" );
RICF_InitFieldNoDefault( &m_name, "Name", "Name", "", "", "" );
m_name.registerKeywordAlias( "WellPathName" );