2019-08-19 13:46:14 +02:00
|
|
|
########################################################################################
|
|
|
|
|
# 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.
|
|
|
|
|
########################################################################################
|
2019-06-03 21:11:27 +02:00
|
|
|
import rips
|
2019-06-04 10:34:31 +02:00
|
|
|
import time
|
2019-08-14 09:14:12 +02:00
|
|
|
import grpc
|
2019-05-30 18:52:38 +02:00
|
|
|
|
2019-09-19 13:25:04 +02:00
|
|
|
resinsight = rips.Instance.find()
|
2019-06-04 10:34:31 +02:00
|
|
|
start = time.time()
|
2019-11-21 08:13:15 +01:00
|
|
|
case = resinsight.project.cases()[0]
|
2019-05-30 18:52:38 +02:00
|
|
|
|
2019-08-19 13:46:14 +02:00
|
|
|
# Read poro result into list
|
2019-09-23 11:50:33 +02:00
|
|
|
poro_results = case.active_cell_property('STATIC_NATIVE', 'PORO', 0)
|
2019-08-19 13:46:14 +02:00
|
|
|
# Read permx result into list
|
2019-09-23 11:50:33 +02:00
|
|
|
permx_results = case.active_cell_property('STATIC_NATIVE', 'PERMX', 0)
|
2019-05-30 18:52:38 +02:00
|
|
|
|
2019-08-19 13:46:14 +02:00
|
|
|
# Generate output result
|
2019-06-03 14:33:16 +02:00
|
|
|
results = []
|
2019-09-19 15:14:01 +02:00
|
|
|
for (poro, permx) in zip(poro_results, permx_results):
|
2019-06-03 14:33:16 +02:00
|
|
|
results.append(poro * permx)
|
|
|
|
|
|
2019-08-19 13:46:14 +02:00
|
|
|
try:
|
|
|
|
|
# Send back output result
|
2019-09-23 11:50:33 +02:00
|
|
|
case.set_active_cell_property(results, 'GENERATED', 'POROPERMXSY', 0)
|
2019-08-14 09:14:12 +02:00
|
|
|
except grpc.RpcError as e:
|
|
|
|
|
print("Exception Received: ", e)
|
|
|
|
|
|
2019-05-30 18:52:38 +02:00
|
|
|
|
2019-06-04 10:34:31 +02:00
|
|
|
end = time.time()
|
|
|
|
|
print("Time elapsed: ", end - start)
|
2019-08-19 13:46:14 +02:00
|
|
|
print("Transferred all results back")
|
|
|
|
|
|
2019-09-19 14:47:48 +02:00
|
|
|
view = case.views()[0].apply_cell_result('GENERATED', 'POROPERMXSY')
|