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,3 +1,7 @@
|
||||
##############################################################################
|
||||
# This example will create a derived result for each time step synchronously
|
||||
##############################################################################
|
||||
|
||||
import rips
|
||||
import time
|
||||
|
||||
@@ -5,18 +9,25 @@ resInsight = rips.Instance.find()
|
||||
start = time.time()
|
||||
case = resInsight.project.case(id=0)
|
||||
|
||||
# Read the full porv result
|
||||
porvResults = case.properties.activeCellProperty('STATIC_NATIVE', 'PORV', 0)
|
||||
timeStepInfo = case.timeSteps()
|
||||
|
||||
for i in range (0, len(timeStepInfo)):
|
||||
# Read the full SOIl result for time step i
|
||||
soilResults = case.properties.activeCellProperty('DYNAMIC_NATIVE', 'SOIL', i)
|
||||
|
||||
# Generate the result by looping through both lists in order
|
||||
results = []
|
||||
for (soil, porv) in zip(soilResults, porvResults):
|
||||
results.append(soil * porv)
|
||||
|
||||
# Send back result
|
||||
case.properties.setActiveCellProperty(results, 'GENERATED', 'SOILPORVSync', i)
|
||||
|
||||
end = time.time()
|
||||
print("Time elapsed: ", end - start)
|
||||
|
||||
print("Transferred all results back")
|
||||
print("Transferred all results back")
|
||||
|
||||
view = case.views()[0].applyCellResult('GENERATED', 'SOILPORVSync')
|
||||
Reference in New Issue
Block a user