mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 06:38:13 -05:00
Consolidate the hand-written PropertyType / NNCPropertyType enums in enums.py into the auto-generated StrEnum classes that already exist in generated_classes.py. enums.py and all its imports are removed. The auto-generated class for caf::AppEnum<RiaDefines::ResultCatType> was named "ResultType" because the existing scriptable m_resultType fields used keyword "ResultType". Switch those fields to CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault, keeping the XML keyword "ResultType" (so project files still load) but exposing the script keyword as "PropertyType". The generator now emits a single PropertyType StrEnum that: - matches the proto PropertyType for setters (FLOAT/INTEGER aside, the members callers actually use are identical), - gains ALLAN_DIAGRAMS that the C++ side already knew about, - loses the proto-only REMOVED/UNDEFINED sentinels (unused in any Python caller). rips.NNCPropertyType was exported but unreferenced anywhere — dropped. Updated Python callers: - rips.ResultType.X -> rips.PropertyType.X across examples and tests. - result_type= kwarg / .result_type attribute -> property_type / .property_type (the script keyword change renamed those everywhere the affected PdmObject fields are accessed from Python). - view.apply_cell_result's hand-written wrapper now takes property_type instead of result_type and forwards via cell_result.property_type. All 271 Python tests pass, ruff and clang-format clean.
49 lines
1.6 KiB
Python
49 lines
1.6 KiB
Python
import sys
|
|
import os
|
|
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)
|