2019-08-19 06:46:14 -05:00
|
|
|
###########################################################################################
|
|
|
|
# This example will synchronously calculate the average value for SOIL for all time steps
|
|
|
|
###########################################################################################
|
2019-06-04 01:43:57 -05:00
|
|
|
import rips
|
|
|
|
import itertools
|
|
|
|
import time
|
|
|
|
|
2019-09-19 06:25:04 -05:00
|
|
|
resinsight = rips.Instance.find()
|
2019-06-04 03:34:31 -05:00
|
|
|
|
|
|
|
start = time.time()
|
2019-06-04 01:43:57 -05:00
|
|
|
|
2019-08-19 06:46:14 -05:00
|
|
|
# Get the case with case id 0
|
2019-09-23 04:50:33 -05:00
|
|
|
case = resinsight.project.case(case_id=0)
|
2019-08-19 06:46:14 -05:00
|
|
|
|
|
|
|
# Get a list of all time steps
|
2019-09-19 08:14:01 -05:00
|
|
|
time_steps = case.time_steps()
|
2019-06-04 01:43:57 -05:00
|
|
|
|
|
|
|
averages = []
|
2019-09-19 08:14:01 -05:00
|
|
|
for i in range(0, len(time_steps)):
|
2019-08-19 06:46:14 -05:00
|
|
|
# Get a list of all the results for time step i
|
2019-09-23 04:50:33 -05:00
|
|
|
results = case.active_cell_property('DYNAMIC_NATIVE', 'SOIL', i)
|
2019-08-07 16:33:08 -05:00
|
|
|
mysum = sum(results)
|
|
|
|
averages.append(mysum/len(results))
|
2019-06-04 01:43:57 -05:00
|
|
|
|
|
|
|
end = time.time()
|
|
|
|
print("Time elapsed: ", end - start)
|
|
|
|
print(averages)
|