Python: Rename example directory to PythonExamples

* This is so that when we add the folder to the Script Path it will look more sensible to the user.
This commit is contained in:
Gaute Lindkvist 2019-08-15 08:07:43 +02:00
parent 4d8ce1e399
commit 824ec5cef6
20 changed files with 33 additions and 23 deletions

View File

@ -169,24 +169,24 @@ if (RESINSIGHT_GRPC_PYTHON_EXECUTABLE)
"rips/Instance.py"
"rips/PdmObject.py"
"rips/View.py"
"rips/examples/InstanceExample.py"
"rips/examples/CommandExample.py"
"rips/examples/CaseGridGroup.py"
"rips/examples/CaseInfoStreamingExample.py"
"rips/examples/ErrorHandling.py"
"rips/examples/SoilPorvAsync.py"
"rips/examples/SoilPorvSync.py"
"rips/examples/SelectedCases.py"
"rips/examples/AllCases.py"
"rips/examples/SetGridProperties.py"
"rips/examples/SetCellResult.py"
"rips/examples/SetFlowDiagnosticsResult.py"
"rips/examples/GridInformation.py"
"rips/examples/InputPropTestSync.py"
"rips/examples/InputPropTestAsync.py"
"rips/examples/SoilAverageAsync.py"
"rips/examples/SoilAverageSync.py"
"rips/examples/SoilAverageNoComm.py"
"rips/PythonExamples/InstanceExample.py"
"rips/PythonExamples/CommandExample.py"
"rips/PythonExamples/CaseGridGroup.py"
"rips/PythonExamples/CaseInfoStreamingExample.py"
"rips/PythonExamples/ErrorHandling.py"
"rips/PythonExamples/SoilPorvAsync.py"
"rips/PythonExamples/SoilPorvSync.py"
"rips/PythonExamples/SelectedCases.py"
"rips/PythonExamples/AllCases.py"
"rips/PythonExamples/SetGridProperties.py"
"rips/PythonExamples/SetCellResult.py"
"rips/PythonExamples/SetFlowDiagnosticsResult.py"
"rips/PythonExamples/GridInformation.py"
"rips/PythonExamples/InputPropTestSync.py"
"rips/PythonExamples/InputPropTestAsync.py"
"rips/PythonExamples/SoilAverageAsync.py"
"rips/PythonExamples/SoilAverageSync.py"
"rips/PythonExamples/SoilAverageNoComm.py"
"rips/tests/test_cases.py"
"rips/tests/test_commands.py"
"rips/tests/test_grids.py"

View File

@ -1,17 +1,18 @@
import rips
import time
import numpy as np
def createResult(soilChunks, porvChunks):
for (soilChunk, porvChunk) in zip(soilChunks, porvChunks):
resultChunk = []
number = 0
for (soil, porv) in zip(soilChunk.values, porvChunk.values):
resultChunk.append(soil * porv)
number += 1
yield resultChunk
npSoilChunk = np.array(soilChunk.values)
npPorvChunk = np.array(porvChunk.values)
yield npSoilChunk + npPorvChunk
resInsight = rips.Instance.find()
start = time.time()
case = resInsight.project.case(id=0)
timeStepInfo = case.timeSteps()
@ -25,4 +26,7 @@ for i in range (0, len(timeStepInfo)):
input_iterator = createResult(soilChunks, iter(porvArray))
case.properties.setActiveCellPropertyAsync(input_iterator, 'GENERATED', 'SOILPORVAsync', i)
end = time.time()
print("Time elapsed: ", end - start)
print("Transferred all results back")

View File

@ -1,6 +1,8 @@
import rips
import time
resInsight = rips.Instance.find()
start = time.time()
case = resInsight.project.case(id=0)
porvResults = case.properties.activeCellProperty('STATIC_NATIVE', 'PORV', 0)
@ -13,4 +15,8 @@ for i in range (0, len(timeStepInfo)):
results.append(soil * porv)
case.properties.setActiveCellProperty(results, 'GENERATED', 'SOILPORVSync', i)
end = time.time()
print("Time elapsed: ", end - start)
print("Transferred all results back")