mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5792 Python : Add import_summary_case and find summary case from ID
Add example of use and updated documentation
This commit is contained in:
committed by
Gaute Lindkvist
parent
dfc93164d0
commit
8662ff90d2
@@ -1,18 +1,31 @@
|
||||
import rips
|
||||
import time
|
||||
|
||||
resinsight = rips.Instance.find()
|
||||
|
||||
project = resinsight.project
|
||||
summary_cases = project.descendants(rips.SummaryCase)
|
||||
|
||||
# Assumes at least one summery case loaded
|
||||
firstCase = summary_cases[0]
|
||||
# Use the following commented lines to import a file from disk
|
||||
# filename = "path/to/file/1_R001_REEK-0.SMSPEC"
|
||||
# summary_case = project.import_summary_case(filename)
|
||||
|
||||
# Assumes at least one summery case loaded with case_id 1
|
||||
summary_case = project.summary_case(1)
|
||||
if summary_case is None:
|
||||
print("No summary case found")
|
||||
exit()
|
||||
|
||||
vector_name = "FOPT"
|
||||
summary_data = firstCase.summary_vector_values(vector_name)
|
||||
summary_data = summary_case.summary_vector_values(vector_name)
|
||||
|
||||
print("Data for summary vector " + vector_name)
|
||||
print(summary_data.values)
|
||||
|
||||
time_steps = firstCase.available_time_steps()
|
||||
time_steps = summary_case.available_time_steps()
|
||||
print(time_steps.values)
|
||||
|
||||
summary_data_sampled = summary_case.resample_values("FOPT", "QUARTER")
|
||||
print("\nResampled data")
|
||||
|
||||
for t, value in zip(summary_data_sampled.time_steps, summary_data_sampled.values):
|
||||
print(time.strftime("%a, %d %b %Y ", time.gmtime(t)) + " | " + str(value))
|
||||
|
||||
Reference in New Issue
Block a user