Files
ResInsight/ApplicationCode/GrpcInterface/Python/examples/InputPropTestAsync.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

27 lines
833 B
Python

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