2019-08-19 06:46:14 -05:00
|
|
|
############################################################################
|
|
|
|
# This script will export snapshots for two properties in every loaded case
|
|
|
|
# And put them in a snapshots folder in the same folder as the case grid
|
|
|
|
############################################################################
|
|
|
|
import os
|
|
|
|
import rips
|
|
|
|
|
|
|
|
# Load instance
|
2019-09-19 06:25:04 -05:00
|
|
|
resinsight = rips.Instance.find()
|
|
|
|
cases = resinsight.project.cases()
|
2019-08-19 06:46:14 -05:00
|
|
|
|
|
|
|
# Set main window size
|
2019-09-23 04:50:33 -05:00
|
|
|
resinsight.set_main_window_size(width=800, height=500)
|
2019-08-19 06:46:14 -05:00
|
|
|
|
2021-01-26 13:48:01 -06:00
|
|
|
n = 5 # every n-th time_step for snapshot
|
|
|
|
property_list = ["SOIL", "PRESSURE"] # list of parameter for snapshot
|
2019-08-19 06:46:14 -05:00
|
|
|
|
2021-01-26 13:48:01 -06:00
|
|
|
print("Looping through cases")
|
2019-08-19 06:46:14 -05:00
|
|
|
for case in cases:
|
2019-09-23 04:50:33 -05:00
|
|
|
print("Case name: ", case.name)
|
2020-02-21 05:10:02 -06:00
|
|
|
print("Case id: ", case.id)
|
2019-08-19 06:46:14 -05:00
|
|
|
# Get grid path and its folder name
|
2020-02-21 05:10:02 -06:00
|
|
|
case_path = case.file_path
|
2019-09-19 06:25:04 -05:00
|
|
|
folder_name = os.path.dirname(case_path)
|
2021-01-26 13:48:01 -06:00
|
|
|
|
2019-08-19 06:46:14 -05:00
|
|
|
# create a folder to hold the snapshots
|
2021-01-26 13:48:01 -06:00
|
|
|
dirname = os.path.join(folder_name, "snapshots")
|
|
|
|
|
2019-08-19 06:46:14 -05:00
|
|
|
if os.path.exists(dirname) is False:
|
|
|
|
os.mkdir(dirname)
|
2021-01-26 13:48:01 -06:00
|
|
|
|
|
|
|
print("Exporting to folder: " + dirname)
|
|
|
|
resinsight.set_export_folder(export_type="SNAPSHOTS", path=dirname)
|
|
|
|
|
2019-09-19 06:25:04 -05:00
|
|
|
time_steps = case.time_steps()
|
2021-01-26 13:48:01 -06:00
|
|
|
print("Number of time_steps: " + str(len(time_steps)))
|
2020-01-21 01:48:56 -06:00
|
|
|
|
|
|
|
for view in case.views():
|
|
|
|
if view.is_eclipse_view():
|
|
|
|
for property in property_list:
|
2021-01-26 13:48:01 -06:00
|
|
|
view.apply_cell_result(
|
|
|
|
result_type="DYNAMIC_NATIVE", result_variable=property
|
|
|
|
)
|
2019-09-23 04:50:33 -05:00
|
|
|
for time_step in range(0, len(time_steps), 10):
|
2021-01-26 13:48:01 -06:00
|
|
|
view.set_time_step(time_step=time_step)
|
2019-09-23 04:50:33 -05:00
|
|
|
view.export_snapshot()
|