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

28 lines
1002 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
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
cellCounts = case.cellCount()
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
activeCellInfos = case.cellInfoForActiveCells()
# 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])