#4736 View.py renames

This commit is contained in:
Gaute Lindkvist 2019-09-19 14:47:48 +02:00
parent 3aa3bb67a7
commit 502a1532b6
10 changed files with 51 additions and 51 deletions

View File

@ -23,7 +23,7 @@ case_group.print_object_info()
resinsight.commands.compute_case_group_statistics(case_group_id=case_group.group_id)
view = case_group.views()[0]
cellResult = view.cellResult()
cellResult = view.set_cell_result()
cellResult.set_value("ResultVariable", "PRESSURE_DEV")
cellResult.update()

View File

@ -37,7 +37,7 @@ for case in cases:
view = case.views()[0]
for property in property_list:
view.applyCellResult(resultType='DYNAMIC_NATIVE', resultVariable=property)
view.apply_cell_result(result_type='DYNAMIC_NATIVE', result_variable=property)
for ts_snapshot in tss_snapshot:
resinsight.commands.set_time_step(case_id = case.id, time_step = ts_snapshot)
resinsight.commands.export_snapshots(type='VIEWS', case_id=case.id) # ALL, VIEWS or PLOTS default is 'ALL'

View File

@ -35,4 +35,4 @@ case.properties.set_active_cell_property_async(createResult(poroChunks, permxChu
end = time.time()
print("Time elapsed: ", end - start)
print("Transferred all results back")
view = case.views()[0].applyCellResult('GENERATED', 'POROPERMXAS')
view = case.views()[0].apply_cell_result('GENERATED', 'POROPERMXAS')

View File

@ -32,4 +32,4 @@ end = time.time()
print("Time elapsed: ", end - start)
print("Transferred all results back")
view = case.views()[0].applyCellResult('GENERATED', 'POROPERMXSY')
view = case.views()[0].apply_cell_result('GENERATED', 'POROPERMXSY')

View File

@ -6,4 +6,4 @@ import rips
resinsight = rips.Instance.find()
view = resinsight.project.view(0)
view.applyCellResult(resultType='STATIC_NATIVE', resultVariable='DX')
view.apply_cell_result(resultType='STATIC_NATIVE', resultVariable='DX')

View File

@ -8,11 +8,11 @@ import rips
resinsight = rips.Instance.find()
view = resinsight.project.view(0)
#view.applyFlowDiagnosticsCellResult(resultVariable='Fraction',
#view.apply_flow_diagnostics_cell_result(resultVariable='Fraction',
# selectionMode='FLOW_TR_INJ_AND_PROD')
# Example of setting individual wells. Commented out because well names are case specific.
view.applyFlowDiagnosticsCellResult(resultVariable='Fraction',
view.apply_flow_diagnostics_cell_result(resultVariable='Fraction',
selectionMode='FLOW_TR_BY_SELECTION',
injectors = ['C-1H', 'C-2H', 'F-2H'],
producers = ['B-1AH', 'B-3H', 'D-1H'])

View File

@ -44,4 +44,4 @@ print("Time elapsed: ", end - start)
print("Transferred all results back")
view = case.views()[0].applyCellResult('GENERATED', 'SOILPORVAsync')
view = case.views()[0].apply_cell_result('GENERATED', 'SOILPORVAsync')

View File

@ -30,4 +30,4 @@ print("Time elapsed: ", end - start)
print("Transferred all results back")
view = case.views()[0].applyCellResult('GENERATED', 'SOILPORVSync')
view = case.views()[0].apply_cell_result('GENERATED', 'SOILPORVSync')

View File

@ -16,12 +16,12 @@ if resinsight is not None:
views = case.views()
for view in views:
# Set some parameters for the view
view.setShowGridBox(not view.showGridBox())
view.setBackgroundColor("#3388AA")
view.set_show_grid_box(not view.show_grid_box())
view.set_background_color("#3388AA")
# Update the view in ResInsight
view.update()
# Clone the first view
newView = views[0].clone()
view.setShowGridBox(False)
newView.setBackgroundColor("#FFAA33")
view.set_show_grid_box(False)
newView.set_background_color("#FFAA33")
newView.update()

View File

@ -14,31 +14,31 @@ class View (PdmObject):
PdmObject.__init__(self, pdm_object.pb2_object, pdm_object.channel)
def showGridBox(self):
def show_grid_box(self):
"""Check if the grid box is meant to be shown in the view"""
return self.get_value("ShowGridBox")
def setShowGridBox(self, value):
def set_show_grid_box(self, value):
"""Set if the grid box is meant to be shown in the view"""
self.set_value("ShowGridBox", value)
def backgroundColor(self):
def background_color(self):
"""Get the current background color in the view"""
return self.get_value("ViewBackgroundColor")
def setBackgroundColor(self, bgColor):
def set_background_color(self, bgcolor):
"""Set the background color in the view"""
self.set_value("ViewBackgroundColor", bgColor)
self.set_value("ViewBackgroundColor", bgcolor)
def cellResult(self):
def set_cell_result(self):
"""Retrieve the current cell results"""
return self.children("GridCellResult")[0]
def applyCellResult(self, resultType, resultVariable):
def apply_cell_result(self, result_type, result_variable):
"""Apply a regular cell result
Arguments:
resultType (str): String representing the result category. The valid values are
result_type (str): String representing the result category. The valid values are
- DYNAMIC_NATIVE
- STATIC_NATIVE
- SOURSIMRL
@ -47,54 +47,54 @@ class View (PdmObject):
- FORMATION_NAMES
- FLOW_DIAGNOSTICS
- INJECTION_FLOODING
resultVariable (str): String representing the result variable.
result_variable (str): String representing the result variable.
"""
cellResult = self.cellResult()
cellResult.set_value("ResultType", resultType)
cellResult.set_value("ResultVariable", resultVariable)
cellResult.update()
cell_result = self.set_cell_result()
cell_result.set_value("ResultType", result_type)
cell_result.set_value("ResultVariable", result_variable)
cell_result.update()
def applyFlowDiagnosticsCellResult(self,
resultVariable = 'TOF',
selectionMode = 'FLOW_TR_BY_SELECTION',
def apply_flow_diagnostics_cell_result(self,
result_variable = 'TOF',
selection_mode = 'FLOW_TR_BY_SELECTION',
injectors = [],
producers = []):
"""Apply a flow diagnostics cell result
Arguments:
resultVariable (str): String representing the result value
result_variable (str): String representing the result value
The valid values are 'TOF', 'Fraction', 'MaxFractionTracer' and 'Communication'.
selectionMode (str): String specifying which tracers to select.
selection_mode (str): String specifying which tracers to select.
The valid values are
- FLOW_TR_INJ_AND_PROD (all injector and producer tracers),
- FLOW_TR_PRODUCERS (all producers)
- FLOW_TR_INJECTORS (all injectors),
- FLOW_TR_BY_SELECTION (specify individual tracers in the
injectorTracers and producerTracers variables)
injectorTracers (list): List of injector names (strings) to select.
Requires selectionMode to be 'FLOW_TR_BY_SELECTION'.
producerTracers (list): List of producer tracers (strings) to select.
Requires selectionMode to be 'FLOW_TR_BY_SELECTION'.
injectors and producers variables)
injectors (list): List of injector names (strings) to select.
Requires selection_mode to be 'FLOW_TR_BY_SELECTION'.
producers (list): List of producer tracers (strings) to select.
Requires selection_mode to be 'FLOW_TR_BY_SELECTION'.
"""
cellResult = self.cellResult()
cellResult.set_value("ResultType", "FLOW_DIAGNOSTICS")
cellResult.set_value("ResultVariable", resultVariable)
cellResult.set_value("FlowTracerSelectionMode", selectionMode)
if selectionMode == 'FLOW_TR_BY_SELECTION':
cellResult.set_value("SelectedInjectorTracers", injectors)
cellResult.set_value("SelectedProducerTracers", producers)
cellResult.update()
cell_result = self.set_cell_result()
cell_result.set_value("ResultType", "FLOW_DIAGNOSTICS")
cell_result.set_value("ResultVariable", result_variable)
cell_result.set_value("FlowTracerSelectionMode", selection_mode)
if selection_mode == 'FLOW_TR_BY_SELECTION':
cell_result.set_value("SelectedInjectorTracers", injectors)
cell_result.set_value("SelectedProducerTracers", producers)
cell_result.update()
def case(self):
"""Get the case the view belongs to"""
pdmCase = self.ancestor("EclipseCase")
if pdmCase is None:
pdmCase = self.ancestor("ResInsightGeoMechCase")
if pdmCase is None:
pdm_case = self.ancestor("EclipseCase")
if pdm_case is None:
pdm_case = self.ancestor("ResInsightGeoMechCase")
if pdm_case is None:
return None
return rips.Case(self.channel, pdmCase.get_value("CaseId"))
return rips.Case(self.channel, pdm_case.get_value("CaseId"))
def clone(self):
"""Clone the current view"""
viewId = Commands(self.channel).clone_view(self.id)
return self.case().view(viewId)
view_id = Commands(self.channel).clone_view(self.id)
return self.case().view(view_id)