ResInsight/ApplicationCode/GrpcInterface/Python/rips/PythonExamples/CaseInfoStreamingExample.py

28 lines
1020 B
Python
Raw Normal View History

###############################################################################
# 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
2019-09-19 06:25:04 -05:00
resinsight = rips.Instance.find()
# Get the case with id == 0. This will fail if your project doesn't have a case with id == 0
2019-10-09 03:35:16 -05:00
case = resinsight.project.case(case_id=0)
# Get the cell count object
2019-09-19 08:14:01 -05:00
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))
2019-05-22 09:03:03 -05:00
# Get information for all active cells
2019-09-19 08:14:01 -05:00
active_cell_infos = case.cell_info_for_active_cells()
# A simple check on the size of the cell info
2019-09-19 08:14:01 -05:00
assert(cell_counts.active_cell_count == len(active_cell_infos))
2019-05-22 09:03:03 -05:00
# Print information for the first active cell
print("First active cell: ")
2019-09-19 08:14:01 -05:00
print(active_cell_infos[0])