mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-24 22:27:55 -05:00
#14772 Python: Update examples to use the object methods instead of deprecated wrappers
This commit is contained in:
1 parent
072ef45909
commit
eac6fa3482
8 files changed
+34
-21
No files matched your search
@@ -7,6 +7,10 @@ resinsight = rips.Instance.find()
|
||||
print("ResInsight version: " + resinsight.version_string())
|
||||
|
||||
case = resinsight.project.case(case_id=0)
|
||||
case.replace(
|
||||
case.replace_grid(
|
||||
new_grid_file="C:/Users/lindkvis/Projects/ResInsight/TestModels/Case_with_10_timesteps/Real0/BRUGGE_0000.EGRID"
|
||||
)
|
||||
|
||||
# The project is reloaded, so retrieve the case object again
|
||||
case = resinsight.project.case(case_id=0)
|
||||
print("New case name: " + case.name)
|
||||
+2
-1
@@ -18,7 +18,8 @@ for case_path in case_paths:
|
||||
|
||||
case_group = resinsight.project.create_grid_case_group(case_paths=case_paths)
|
||||
|
||||
case_group.compute_statistics()
|
||||
for statistics_case in case_group.statistics_cases():
|
||||
statistics_case.compute_statistics(update_views=True)
|
||||
|
||||
view = case_group.views()[0]
|
||||
view.apply_cell_result(rips.PropertyType.DYNAMIC_NATIVE, "PRESSURE_DEV")
|
||||
@@ -31,12 +31,14 @@ for case in cases:
|
||||
case_path = case.file_path
|
||||
folder_name = os.path.dirname(case_path)
|
||||
|
||||
# Import formation names
|
||||
case.import_formation_names(
|
||||
# Import formation names and assign them to this case
|
||||
formation_names = resInsight.project.import_formation_names(
|
||||
formation_files=[
|
||||
"D:/Projects/ResInsight-regression-test/ModelData/norne/Norne_ATW2013.lyr"
|
||||
]
|
||||
],
|
||||
apply_to_all_cases=False,
|
||||
)
|
||||
case.set_formation_names(formation_names=formation_names)
|
||||
|
||||
# create a folder to hold the snapshots
|
||||
dirname = os.path.join(folder_name, "snapshots")
|
||||
@@ -45,5 +47,5 @@ for case in cases:
|
||||
for well_path in well_paths[0:4]: # Loop through the first five well paths
|
||||
# Create plot with parameters
|
||||
wbsplot = case.create_well_bore_stability_plot(
|
||||
well_path=well_path.name, time_step=0, parameters=params
|
||||
well_path=well_path, time_step=0, parameters=params
|
||||
)
|
||||
@@ -16,7 +16,9 @@ print("Exporting to: " + export_folder)
|
||||
|
||||
for plot in plots:
|
||||
plot.export_snapshot(export_folder=export_folder, width=1024, height=768)
|
||||
plot.export_snapshot(export_folder=export_folder, output_format="PDF")
|
||||
plot.export_snapshot(
|
||||
export_folder=export_folder, file_format=rips.SnapshotFileFormat.PDF
|
||||
)
|
||||
if isinstance(plot, rips.WellLogPlot):
|
||||
plot.export_data_as_las(export_folder=export_folder)
|
||||
plot.export_data_as_ascii(export_folder=export_folder)
|
||||
+1
-1
@@ -29,6 +29,6 @@ summary_plot_collection.new_summary_plot(
|
||||
plots = resinsight.project.plots()
|
||||
for plot in plots:
|
||||
plot.export_snapshot()
|
||||
# plot.export_snapshot(output_format="PDF")
|
||||
# plot.export_snapshot(file_format=rips.SnapshotFileFormat.PDF)
|
||||
|
||||
resinsight.exit()
|
||||
+6
-4
@@ -8,15 +8,17 @@ import rips
|
||||
# Load instance
|
||||
resinsight = rips.Instance.find()
|
||||
cases = resinsight.project.cases()
|
||||
well_path = resinsight.project.well_path_by_name("Well-1")
|
||||
|
||||
for case in cases:
|
||||
print("Case name: ", case.name)
|
||||
print("Case id: ", case.id)
|
||||
|
||||
case.export_well_path_completions(
|
||||
case.export_completions(
|
||||
well_paths=[well_path],
|
||||
time_step=0,
|
||||
well_path_names=["Well-1"],
|
||||
file_split="UNIFIED_FILE",
|
||||
export_folder="d:/scratch/well_path_export",
|
||||
file_split=rips.CompletionExportSplit.UNIFIED_FILE,
|
||||
include_perforations=True,
|
||||
custom_file_name="d:/scratch/well_path_export/myfile.myext",
|
||||
custom_file_name="myfile.myext",
|
||||
)
|
||||
+5
-4
@@ -66,10 +66,11 @@ for case in cases:
|
||||
print("Case name: ", case.name)
|
||||
print("Case id: ", case.id)
|
||||
|
||||
case.export_well_path_completions(
|
||||
case.export_completions(
|
||||
well_paths=[well_path],
|
||||
time_step=0,
|
||||
well_path_names=["Test Well-1 Y1"],
|
||||
file_split="UNIFIED_FILE",
|
||||
export_folder="f:/scratch/2023-11-02",
|
||||
file_split=rips.CompletionExportSplit.UNIFIED_FILE,
|
||||
include_perforations=True,
|
||||
custom_file_name="f:/scratch/2023-11-02/myfile.myext",
|
||||
custom_file_name="myfile.myext",
|
||||
)
|
||||
@@ -103,11 +103,12 @@ for case in cases:
|
||||
print("Case name: ", case.name)
|
||||
print("Case id: ", case.id)
|
||||
|
||||
case.export_well_path_completions(
|
||||
case.export_completions(
|
||||
well_paths=[well_path],
|
||||
time_step=0,
|
||||
well_path_names=["Test Well-1 Y1"],
|
||||
file_split="UNIFIED_FILE",
|
||||
include_perforations=True,
|
||||
# Replace the following with a valid path
|
||||
custom_file_name="f:/scratch/2023-11-02/myfile.myext",
|
||||
export_folder="f:/scratch/2023-11-02",
|
||||
file_split=rips.CompletionExportSplit.UNIFIED_FILE,
|
||||
include_perforations=True,
|
||||
custom_file_name="myfile.myext",
|
||||
)
|
||||
Reference in new issue
Block a user