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,8 @@
|
||||
########################################################################################
|
||||
# This example generates a derived property in an synchronous manner
|
||||
# Meaning it completes reading each result before calculating the derived result
|
||||
# See InputPropTestAsync for how to do this asynchronously instead.
|
||||
########################################################################################
|
||||
import rips
|
||||
import time
|
||||
import grpc
|
||||
@@ -6,14 +11,18 @@ resInsight = rips.Instance.find()
|
||||
start = time.time()
|
||||
case = resInsight.project.case(id=0)
|
||||
|
||||
# Read poro result into list
|
||||
poroResults = case.properties.activeCellProperty('STATIC_NATIVE', 'PORO', 0)
|
||||
# Read permx result into list
|
||||
permxResults = case.properties.activeCellProperty('STATIC_NATIVE', 'PERMX', 0)
|
||||
|
||||
# Generate output result
|
||||
results = []
|
||||
for (poro, permx) in zip(poroResults, permxResults):
|
||||
results.append(poro * permx)
|
||||
|
||||
try:
|
||||
try:
|
||||
# Send back output result
|
||||
case.properties.setActiveCellProperty(results, 'GENERATED', 'POROPERMXSY', 0)
|
||||
except grpc.RpcError as e:
|
||||
print("Exception Received: ", e)
|
||||
@@ -21,4 +30,6 @@ except grpc.RpcError as e:
|
||||
|
||||
end = time.time()
|
||||
print("Time elapsed: ", end - start)
|
||||
print("Transferred all results back")
|
||||
print("Transferred all results back")
|
||||
|
||||
view = case.views()[0].applyCellResult('GENERATED', 'POROPERMXSY')
|
||||
Reference in New Issue
Block a user