mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4597 Python: add exportSnapshots example and more comments in examples
This commit is contained in:
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user