#4597 Python: add exportSnapshots example and more comments in examples

This commit is contained in:
Gaute Lindkvist
2019-08-19 13:46:14 +02:00
parent edfb39c9b7
commit 6c0e2bb3ad
20 changed files with 226 additions and 53 deletions

View File

@@ -1,22 +1,27 @@
###############################################################################
# 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()
print("Number of active cells: " + str(cellCounts.active_cell_count))
print("Total number of reservoir cells: " + str(cellCounts.reservoir_cell_count))
activeCellInfoChunks = case.cellInfoForActiveCells()
# Get information for all active cells
activeCellInfos = case.cellInfoForActiveCells()
#print("Number of grids: " + str(gridCount))
#print(gridDimensions)
# A simple check on the size of the cell info
assert(cellCounts.active_cell_count == len(activeCellInfos))
receivedActiveCells = []
for activeCellChunk in activeCellInfoChunks:
for activeCell in activeCellChunk.data:
receivedActiveCells.append(activeCell)
assert(cellCounts.active_cell_count == len(receivedActiveCells))
# Print information for the first active cell
print("First active cell: ")
print(receivedActiveCells[0])
print(activeCellInfos[0])