mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4817 #4830 #4832 #4837 #4839 Python commands for WBS creation, well path import and well log file import (#4838)
* Better minimum width for well log tracks * Fix alignment of scrollbar in Well log plots * Better Well Log Plot export * Hide scroll bar before plotting * Better borders * Create plots through Python * #4817 Create WBS plots with Python * Rebase Summary and WellLogPlot on top of a new RimPlot * Also Python: Allow setting folder as a parameter to export_snapshots * #4832 Prepare for well path import command * Well Path import WIP * #4830 #4832 Import well paths and well log files from file using Python. * #4837 Implement import of formation names in Python * Fix debug build issue * Fix RiaLogging build issue * Fix warnings * Yet another RiaLogging.h import added * #4839 Import exporting of las and ascii files from well log plots
This commit is contained in:
@@ -25,7 +25,7 @@ class Case(PdmObject):
|
||||
|
||||
Operate on a ResInsight case specified by a Case Id integer.
|
||||
Not meant to be constructed separately but created by one of the following
|
||||
methods in Project: loadCase, case, allCases, selectedCasesq
|
||||
methods in Project: loadCase, case, allCases, selectedCases
|
||||
|
||||
Attributes:
|
||||
id (int): Case Id corresponding to case Id in ResInsight project.
|
||||
@@ -37,11 +37,12 @@ class Case(PdmObject):
|
||||
However we need overhead space, so the default is 8160.
|
||||
This leaves 256B for overhead.
|
||||
"""
|
||||
def __init__(self, channel, case_id):
|
||||
def __init__(self, channel, case_id, project):
|
||||
# Private properties
|
||||
self.__channel = channel
|
||||
self.__case_stub = Case_pb2_grpc.CaseStub(channel)
|
||||
self.__request = Case_pb2.CaseRequest(id=case_id)
|
||||
self.__project = project
|
||||
|
||||
info = self.__case_stub.GetCaseInfo(self.__request)
|
||||
self.__properties_stub = Properties_pb2_grpc.PropertiesStub(
|
||||
@@ -51,7 +52,9 @@ class Case(PdmObject):
|
||||
|
||||
# Public properties
|
||||
self.case_id = case_id
|
||||
self.group_id = info.group_id
|
||||
self.name = info.name
|
||||
self.type = info.type
|
||||
self.chunk_size = 8160
|
||||
|
||||
def __grid_count(self):
|
||||
@@ -248,16 +251,17 @@ class Case(PdmObject):
|
||||
self._execute_command(createView=Cmd.CreateViewRequest(
|
||||
caseId=self.case_id)).createViewResult.viewId)
|
||||
|
||||
def export_snapshots_of_all_views(self, prefix=""):
|
||||
def export_snapshots_of_all_views(self, prefix="", export_folder=""):
|
||||
""" Export snapshots for all views in the case
|
||||
|
||||
Arguments:
|
||||
prefix (str): Exported file name prefix
|
||||
export_folder(str): The path to export to. By default will use the global export folder
|
||||
|
||||
"""
|
||||
return self._execute_command(
|
||||
exportSnapshots=Cmd.ExportSnapshotsRequest(
|
||||
type="VIEWS", prefix=prefix, caseId=self.case_id, viewId=-1))
|
||||
type="VIEWS", prefix=prefix, caseId=self.case_id, viewId=-1, exportFolder=export_folder))
|
||||
|
||||
def export_well_path_completions(
|
||||
self,
|
||||
@@ -732,3 +736,33 @@ class Case(PdmObject):
|
||||
undefinedValue=undefined_value,
|
||||
exportFile=export_file,
|
||||
))
|
||||
|
||||
def create_well_bore_stability_plot(self, well_path, time_step):
|
||||
""" Create a new well bore stability plot
|
||||
|
||||
Arguments:
|
||||
well_path(str): well path name
|
||||
time_step(int): time step
|
||||
|
||||
Returns:
|
||||
A new plot object
|
||||
"""
|
||||
plot_result = self._execute_command(createWellBoreStabilityPlot=Cmd.CreateWbsPlotRequest(caseId=self.case_id,
|
||||
wellPath=well_path,
|
||||
timeStep=time_step))
|
||||
return self.__project.plot(view_id=plot_result.createWbsPlotResult.viewId)
|
||||
|
||||
def import_formation_names(self, formation_files=None):
|
||||
""" Import formation names into project and apply it to the current case
|
||||
|
||||
Arguments:
|
||||
formation_files(list): list of files to import
|
||||
|
||||
"""
|
||||
if formation_files is None:
|
||||
formation_files = []
|
||||
elif isinstance(formation_files, str):
|
||||
formation_files = [formation_files]
|
||||
|
||||
res = self._execute_command(importFormationNames=Cmd.ImportFormationNamesRequest(formationFiles=formation_files,
|
||||
applyToCaseId=self.case_id))
|
||||
Reference in New Issue
Block a user