Files
ResInsight/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/CaseInfoStreamingExample.py
Gaute Lindkvist a2bad82391 #4736 System python command refactor (#4743)
* Move case loading commands from Commands to project and case
* Major refactor
* Fix problems with Python examples
* Add ability to export snapshot from just one view + fixup
* Case comments and black
* Make all modules pass pylint test
2019-09-23 11:50:33 +02:00

28 lines
1015 B
Python

###############################################################################
# This example will get the cell info for the active cells for the first case
###############################################################################
# Import the ResInsight Processing Server Module
import rips
# Connect to ResInsight
resinsight = rips.Instance.find()
# Get the case with id == 0. This will fail if your project doesn't have a case with id == 0
case = resinsight.project.case(id=0)
# Get the cell count object
cell_counts = case.cell_count()
print("Number of active cells: " + str(cell_counts.active_cell_count))
print("Total number of reservoir cells: " + str(cell_counts.reservoir_cell_count))
# Get information for all active cells
active_cell_infos = case.cell_info_for_active_cells()
# A simple check on the size of the cell info
assert(cell_counts.active_cell_count == len(active_cell_infos))
# Print information for the first active cell
print("First active cell: ")
print(active_cell_infos[0])