mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-28 18:01:08 -06:00
Add script used to compute statistics on generated data in Python
This commit is contained in:
parent
aaecd846fd
commit
ad4930db79
@ -3,13 +3,14 @@ import rips
|
||||
|
||||
resinsight = rips.Instance.find()
|
||||
|
||||
test_model_path = "e:/gitroot-second/ResInsight/TestModels"
|
||||
|
||||
case_paths = []
|
||||
case_paths.append(
|
||||
"C:/Users/lindk/source/repos/ResInsight/TestModels/Case_with_10_timesteps/Real0/BRUGGE_0000.EGRID"
|
||||
)
|
||||
case_paths.append(
|
||||
"C:/Users/lindk/source/repos/ResInsight/TestModels/Case_with_10_timesteps/Real10/BRUGGE_0010.EGRID"
|
||||
)
|
||||
case_paths.append(test_model_path + "/Case_with_10_timesteps/Real0/BRUGGE_0000.EGRID")
|
||||
case_paths.append(test_model_path + "/Case_with_10_timesteps/Real10/BRUGGE_0010.EGRID")
|
||||
case_paths.append(test_model_path + "/Case_with_10_timesteps/Real30/BRUGGE_0030.EGRID")
|
||||
case_paths.append(test_model_path + "/Case_with_10_timesteps/Real40/BRUGGE_0040.EGRID")
|
||||
|
||||
for case_path in case_paths:
|
||||
assert os.path.exists(
|
||||
case_path
|
||||
|
@ -0,0 +1,58 @@
|
||||
import os
|
||||
import rips
|
||||
|
||||
resinsight = rips.Instance.find()
|
||||
|
||||
# ResInsight includes some test models. Adjust this path to fit your system
|
||||
test_model_path = "e:/gitroot-second/ResInsight/TestModels"
|
||||
|
||||
case_paths = []
|
||||
case_paths.append(test_model_path + "/Case_with_10_timesteps/Real0/BRUGGE_0000.EGRID")
|
||||
case_paths.append(test_model_path + "/Case_with_10_timesteps/Real10/BRUGGE_0010.EGRID")
|
||||
case_paths.append(test_model_path + "/Case_with_10_timesteps/Real30/BRUGGE_0030.EGRID")
|
||||
case_paths.append(test_model_path + "/Case_with_10_timesteps/Real40/BRUGGE_0040.EGRID")
|
||||
|
||||
for case_path in case_paths:
|
||||
assert os.path.exists(
|
||||
case_path
|
||||
), "You need to set valid case paths for this script to work"
|
||||
|
||||
case_group = resinsight.project.create_grid_case_group(case_paths=case_paths)
|
||||
|
||||
cases = case_group.descendants(rips.EclipseCase)
|
||||
print("Got " + str(len(cases)) + " cases: ")
|
||||
|
||||
for case in cases:
|
||||
time_step_info = case.time_steps()
|
||||
porv_results = case.active_cell_property("STATIC_NATIVE", "PORV", 0)
|
||||
|
||||
for time_step_index in range(0, len(time_step_info)):
|
||||
pressure_results = case.active_cell_property(
|
||||
"DYNAMIC_NATIVE", "PRESSURE", time_step_index
|
||||
)
|
||||
|
||||
results = []
|
||||
for pressure, porv in zip(pressure_results, porv_results):
|
||||
results.append(pressure * porv)
|
||||
|
||||
# set the computed values in the case
|
||||
case.set_active_cell_property(
|
||||
results, "GENERATED", "PRESSURE_PORV", time_step_index
|
||||
)
|
||||
|
||||
print(
|
||||
"Case id: " + str(case.id),
|
||||
" Case name: " + case.name,
|
||||
" : Calculation complete",
|
||||
)
|
||||
|
||||
|
||||
print("Transferred all results back to ResInsight")
|
||||
|
||||
# The API does not support configuration of a computation
|
||||
# Suggested next steps
|
||||
# - open ResInsight
|
||||
# - select the statistics object
|
||||
# - select the generated result(PRESSURE_PORV) as source for computations
|
||||
# - compute statistics
|
||||
# - create a view and investigate the statistics of the generated data (PRESSURE_PORV)
|
Loading…
Reference in New Issue
Block a user