diff --git a/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/CaseGridGroup.py b/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/CaseGridGroup.py index 4a23419f34..1b2c4a5b6d 100644 --- a/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/CaseGridGroup.py +++ b/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/CaseGridGroup.py @@ -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() \ No newline at end of file diff --git a/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/ExportSnapshots.py b/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/ExportSnapshots.py index f957675d03..380cfcff12 100644 --- a/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/ExportSnapshots.py +++ b/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/ExportSnapshots.py @@ -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' diff --git a/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/InputPropTestAsync.py b/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/InputPropTestAsync.py index 4b962b464f..534fbf0dd0 100644 --- a/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/InputPropTestAsync.py +++ b/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/InputPropTestAsync.py @@ -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') \ No newline at end of file +view = case.views()[0].apply_cell_result('GENERATED', 'POROPERMXAS') \ No newline at end of file diff --git a/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/InputPropTestSync.py b/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/InputPropTestSync.py index 82f817ff28..dd021e3f5d 100644 --- a/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/InputPropTestSync.py +++ b/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/InputPropTestSync.py @@ -32,4 +32,4 @@ end = time.time() print("Time elapsed: ", end - start) print("Transferred all results back") -view = case.views()[0].applyCellResult('GENERATED', 'POROPERMXSY') \ No newline at end of file +view = case.views()[0].apply_cell_result('GENERATED', 'POROPERMXSY') \ No newline at end of file diff --git a/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/SetCellResult.py b/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/SetCellResult.py index aa42adea73..f527d6d3db 100644 --- a/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/SetCellResult.py +++ b/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/SetCellResult.py @@ -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') diff --git a/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/SetFlowDiagnosticsResult.py b/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/SetFlowDiagnosticsResult.py index eb72a726ab..d438cf1622 100644 --- a/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/SetFlowDiagnosticsResult.py +++ b/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/SetFlowDiagnosticsResult.py @@ -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']) diff --git a/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/SoilPorvAsync.py b/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/SoilPorvAsync.py index c7b44f71ba..e1c443eba6 100644 --- a/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/SoilPorvAsync.py +++ b/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/SoilPorvAsync.py @@ -44,4 +44,4 @@ print("Time elapsed: ", end - start) print("Transferred all results back") -view = case.views()[0].applyCellResult('GENERATED', 'SOILPORVAsync') \ No newline at end of file +view = case.views()[0].apply_cell_result('GENERATED', 'SOILPORVAsync') \ No newline at end of file diff --git a/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/SoilPorvSync.py b/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/SoilPorvSync.py index 303e58f305..c895bf3f43 100644 --- a/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/SoilPorvSync.py +++ b/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/SoilPorvSync.py @@ -30,4 +30,4 @@ print("Time elapsed: ", end - start) print("Transferred all results back") -view = case.views()[0].applyCellResult('GENERATED', 'SOILPORVSync') \ No newline at end of file +view = case.views()[0].apply_cell_result('GENERATED', 'SOILPORVSync') \ No newline at end of file diff --git a/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/ViewExample.py b/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/ViewExample.py index 25195036ec..fdde45c8e1 100644 --- a/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/ViewExample.py +++ b/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/ViewExample.py @@ -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() \ No newline at end of file diff --git a/ApplicationCode/GrpcInterface/Python/rips/View.py b/ApplicationCode/GrpcInterface/Python/rips/View.py index 5c70dee555..504d1387dc 100644 --- a/ApplicationCode/GrpcInterface/Python/rips/View.py +++ b/ApplicationCode/GrpcInterface/Python/rips/View.py @@ -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) \ No newline at end of file + view_id = Commands(self.channel).clone_view(self.id) + return self.case().view(view_id)