Files
ResInsight/ApplicationCode/GrpcInterface/Python/examples/InputPropTestSync.py
Gaute Lindkvist 930abbf02f Python: added tests and made Octave InputPropTest.m general
* removed non-general hard-coded grid sizes and added timing to Octave test
* added two Pythonbenchmarks (sync and async) for the same test
2019-06-04 10:49:35 +02:00

32 lines
855 B
Python

import sys
import os
sys.path.insert(1, os.path.join(sys.path[0], '..'))
import rips
import time
resInsight = rips.Instance.find()
start = time.time()
case = resInsight.project.case(id=0)
poroChunks = case.properties.activeCellProperty('STATIC_NATIVE', 'PORO', 0)
poroResults = []
for poroChunk in poroChunks:
for poro in poroChunk.values:
poroResults.append(poro)
permxChunks = case.properties.activeCellProperty('STATIC_NATIVE', 'PERMX', 0)
permxResults = []
for permxChunk in permxChunks:
for permx in permxChunk.values:
permxResults.append(permx)
results = []
for (poro, permx) in zip(poroResults, permxResults):
results.append(poro * permx)
case.properties.setActiveCellProperty(results, 'GENERATED', 'POROPERMXSY', 0)
end = time.time()
print("Time elapsed: ", end - start)
print("Transferred all results back")