Files
ResInsight/Python/examples/GridInfoStreamingExample.py
T
Gaute Lindkvist 922386c673 #4416 First implementation of gRPC-based Python interface
First implementation with Asynchronous gRPC server, a few services and some client python code.
2019-05-20 13:21:02 +02:00

22 lines
692 B
Python

import sys
import os
sys.path.insert(1, os.path.join(sys.path[0], '../api'))
import ResInsight
resInsight = ResInsight.Instance.find()
#gridCount = resInsight.gridInfo.getGridCount(caseId=0)
#gridDimensions = resInsight.gridInfo.getAllGridDimensions(caseId=0)
activeCellInfoChunks = resInsight.gridInfo.streamActiveCellInfo(caseId=0)
#print("Number of grids: " + str(gridCount))
#print(gridDimensions)
receivedActiveCells = []
for activeCellChunk in activeCellInfoChunks:
for activeCell in activeCellChunk.data:
receivedActiveCells.append(activeCell)
print("Number of active cells: " + str(len(receivedActiveCells)))
print("First active cell: ")
print(receivedActiveCells[0])