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

28 lines
1007 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 13:25:04 +02: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-09-19 13:25:04 +02:00
case = resinsight.project.case(id = 0)
# Get the cell count object
2019-09-19 11:14:40 +02:00
cellCounts = case.cell_count()
2019-05-22 16:03:03 +02:00
print("Number of active cells: " + str(cellCounts.active_cell_count))
print("Total number of reservoir cells: " + str(cellCounts.reservoir_cell_count))
2019-05-22 16:03:03 +02:00
# Get information for all active cells
2019-09-19 11:14:40 +02:00
activeCellInfos = case.cell_info_for_active_cells()
# A simple check on the size of the cell info
assert(cellCounts.active_cell_count == len(activeCellInfos))
2019-05-22 16:03:03 +02:00
# Print information for the first active cell
print("First active cell: ")
print(activeCellInfos[0])