mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 07:00:17 -05:00
RimWellLogPlot_exportDataAsLas and RimWellLogPlot_exportDataAsAscii return the exported file names. RicfExportWellLogPlotData picks the method from the exportFormat and forwards to it. Add RicfForwarding::findWellLogPlot(). The Python wrappers keep their signature and List[str] return value, now calling the object methods. The misspelled export_tvdrkb argument is kept as a deprecated alias of export_tvd_rkb.
76 lines
2.5 KiB
Python
76 lines
2.5 KiB
Python
import sys
|
|
import os
|
|
import pytest
|
|
import tempfile
|
|
|
|
sys.path.insert(1, os.path.join(sys.path[0], "../../"))
|
|
import rips
|
|
|
|
import dataroot
|
|
|
|
|
|
def test_10k_well_log_extraction(rips_instance, initialize_test):
|
|
case_root_path = dataroot.PATH + "/TEST10K_FLT_LGR_NNC"
|
|
case_path = case_root_path + "/TEST10K_FLT_LGR_NNC.EGRID"
|
|
case = rips_instance.project.load_case(path=case_path)
|
|
assert len(case.grids()) == 2
|
|
well_path_files = [
|
|
case_root_path + "/wellpath_a.dev",
|
|
]
|
|
|
|
view = case.create_view()
|
|
view.set_time_step(1)
|
|
|
|
well_path_names = rips_instance.project.import_well_paths(well_path_files)
|
|
assert len(well_path_names) == 1
|
|
wells = rips_instance.project.well_paths()
|
|
well_path = wells[0]
|
|
|
|
properties = [
|
|
(rips.PropertyType.STATIC_NATIVE, "INDEX_K", 0),
|
|
(rips.PropertyType.STATIC_NATIVE, "PORO", 0),
|
|
(rips.PropertyType.STATIC_NATIVE, "PERMX", 0),
|
|
(rips.PropertyType.DYNAMIC_NATIVE, "PRESSURE", 0),
|
|
]
|
|
|
|
well_log_plot_collection = rips_instance.project.descendants(
|
|
rips.WellLogPlotCollection
|
|
)[0]
|
|
|
|
well_log_plot = well_log_plot_collection.new_well_log_plot(case, well_path)
|
|
|
|
# Create a track for each property
|
|
for prop_type, prop_name, time_step in properties:
|
|
track = well_log_plot.new_well_log_track("Track: " + prop_name, case, well_path)
|
|
c = track.add_extraction_curve(case, well_path, prop_type, prop_name, time_step)
|
|
assert c
|
|
|
|
with tempfile.TemporaryDirectory(prefix="rips") as tmpdirname:
|
|
well_log_plot.export_data_as_las(export_folder=tmpdirname)
|
|
|
|
|
|
def test_export_data_as_ascii(rips_instance, initialize_test):
|
|
project = rips_instance.project.open(
|
|
dataroot.PATH + "/TEST10K_FLT_LGR_NNC/10KWithWellLog.rsp"
|
|
)
|
|
well_log_plots = [
|
|
plot for plot in project.plots() if isinstance(plot, rips.WellLogPlot)
|
|
]
|
|
assert len(well_log_plots) > 0
|
|
|
|
with tempfile.TemporaryDirectory(prefix="rips") as tmpdirname:
|
|
files = well_log_plots[0].export_data_as_ascii(
|
|
export_folder=tmpdirname, file_prefix="pfx_"
|
|
)
|
|
assert len(files) == 1
|
|
assert os.path.exists(files[0])
|
|
assert os.path.basename(files[0]).startswith("pfx_")
|
|
|
|
las_files = well_log_plots[0].export_data_as_las(export_folder=tmpdirname)
|
|
assert len(las_files) >= 1
|
|
for las in las_files:
|
|
assert las.endswith(".las")
|
|
|
|
with pytest.raises(rips.RipsError):
|
|
well_log_plots[0].export_data_as_las(export_folder="/does/not/exist")
|