diff --git a/src/everest_models/jobs/fm_well_trajectory/resinsight.py b/src/everest_models/jobs/fm_well_trajectory/resinsight.py index 03c7176..a1641c8 100644 --- a/src/everest_models/jobs/fm_well_trajectory/resinsight.py +++ b/src/everest_models/jobs/fm_well_trajectory/resinsight.py @@ -155,7 +155,7 @@ def _find_time_step( def _create_tracks( - properties: Iterable[str], + properties: Iterable[Union[DynamicDomainProperty, StaticDomainProperty]], property_type: str, case: rips.Case, well_path: rips.WellPath, @@ -163,9 +163,11 @@ def _create_tracks( time_step_num: Optional[int] = None, ) -> None: for property in properties: - track = well_log_plot.new_well_log_track(f"Track: {property}", case, well_path) + track = well_log_plot.new_well_log_track( + f"Track: {property.key}", case, well_path + ) track.add_extraction_curve( - case, well_path, property_type, property, time_step_num + case, well_path, property_type, property.key, time_step_num ) @@ -364,7 +366,7 @@ def _generate_welspecs( lines = file_obj.readlines() with open(export_filename, "w") as file_obj: - welspecs = False, False + welspecs, compdat = False, False for line in lines: stripped_line = line.strip() if not stripped_line or stripped_line.startswith("--"): diff --git a/tests/jobs/well_trajectory/test_well_trajectory_resinsight.py b/tests/jobs/well_trajectory/test_well_trajectory_resinsight.py index 4c5a37b..634c58f 100644 --- a/tests/jobs/well_trajectory/test_well_trajectory_resinsight.py +++ b/tests/jobs/well_trajectory/test_well_trajectory_resinsight.py @@ -95,3 +95,35 @@ def test_well_trajectory_resinsight_main_entry_point_mixed( output = expected.relative_to("expected_mixed") assert output.is_file() assert filecmp.cmp(expected, output, shallow=False) + + +@pytest.mark.resinsight +def test_well_trajectory_resinsight_main_entry_point_no_mlt_static_perforation( + copy_testdata_tmpdir, +): + copy_testdata_tmpdir(Path(TEST_DATA) / "resinsight") + for path in Path.cwd().glob("mlt_*.json"): + path.unlink() + main_entry_point("-c config_static_perforation.yml -E SPE1CASE1".split()) + + for expected in Path("expected").glob("**/*"): + if expected.is_file(): + output = expected.relative_to("expected") + assert output.is_file() + assert filecmp.cmp(expected, output, shallow=False) + + +@pytest.mark.resinsight +def test_well_trajectory_resinsight_main_entry_point_no_mlt_dynamic_perforation( + copy_testdata_tmpdir, +): + copy_testdata_tmpdir(Path(TEST_DATA) / "resinsight") + for path in Path.cwd().glob("mlt_*.json"): + path.unlink() + main_entry_point("-c config_dynamic_perforation.yml -E SPE1CASE1".split()) + + for expected in Path("expected").glob("**/*"): + if expected.is_file(): + output = expected.relative_to("expected") + assert output.is_file() + assert filecmp.cmp(expected, output, shallow=False) diff --git a/tests/testdata/well_trajectory/resinsight/SPE1CASE1.DATA b/tests/testdata/well_trajectory/resinsight/SPE1CASE1.DATA index e1a0524..28c890c 100644 --- a/tests/testdata/well_trajectory/resinsight/SPE1CASE1.DATA +++ b/tests/testdata/well_trajectory/resinsight/SPE1CASE1.DATA @@ -387,6 +387,7 @@ WCONINJE DATES 1 'JAN' 2015 / +2 'JAN' 2015 / / END diff --git a/tests/testdata/well_trajectory/resinsight/SPE1CASE1.SMSPEC b/tests/testdata/well_trajectory/resinsight/SPE1CASE1.SMSPEC new file mode 100644 index 0000000..a5e88bd Binary files /dev/null and b/tests/testdata/well_trajectory/resinsight/SPE1CASE1.SMSPEC differ diff --git a/tests/testdata/well_trajectory/resinsight/SPE1CASE1.UNRST b/tests/testdata/well_trajectory/resinsight/SPE1CASE1.UNRST new file mode 100644 index 0000000..fbd2414 Binary files /dev/null and b/tests/testdata/well_trajectory/resinsight/SPE1CASE1.UNRST differ diff --git a/tests/testdata/well_trajectory/resinsight/SPE1CASE1.UNSMRY b/tests/testdata/well_trajectory/resinsight/SPE1CASE1.UNSMRY new file mode 100644 index 0000000..09d403d Binary files /dev/null and b/tests/testdata/well_trajectory/resinsight/SPE1CASE1.UNSMRY differ diff --git a/tests/testdata/well_trajectory/resinsight/config.yml b/tests/testdata/well_trajectory/resinsight/config.yml index 465a91e..d261d9b 100644 --- a/tests/testdata/well_trajectory/resinsight/config.yml +++ b/tests/testdata/well_trajectory/resinsight/config.yml @@ -1,41 +1,40 @@ scales: - x: 4000 - y: 4000 - z: 300 - k: 50 + x: 4000 + y: 4000 + z: 300 + k: 50 references: - x: 5000 - y: 5000 - z: 8375 - k: 50 + x: 5000 + y: 5000 + z: 8375 + k: 50 interpolation: - type: resinsight - measured_depth_step: 5.0 + type: resinsight + measured_depth_step: 5.0 connections: - type: resinsight - date: 2015-01-01 - formations_file: ./formations.lyr - perforations: - - well: INJ - formations: [0, 1, 2] - - well: PROD - formations: [0, 1, 2] + type: resinsight + date: 2015-01-02 + formations_file: ./formations.lyr + perforations: + - well: INJ + formations: [0, 1, 2] + - well: PROD + formations: [0, 1, 2] wells: - - name: INJ - group: G1 - phase: GAS - platform: PLATFORM - cost: 0 - dogleg: 4 - - name: PROD - group: G1 - phase: OIL - platform: PLATFORM - cost: 0 - dogleg: 4 + - name: INJ + group: G1 + phase: GAS + platform: PLATFORM + cost: 0 + dogleg: 4 + - name: PROD + group: G1 + phase: OIL + platform: PLATFORM + cost: 0 + dogleg: 4 platforms: - - name: PLATFORM - x: 5000 - y: 5000 - k: 50 - + - name: PLATFORM + x: 5000 + y: 5000 + k: 50 diff --git a/tests/testdata/well_trajectory/resinsight/config_dynamic_perforation.yml b/tests/testdata/well_trajectory/resinsight/config_dynamic_perforation.yml new file mode 100644 index 0000000..682c51a --- /dev/null +++ b/tests/testdata/well_trajectory/resinsight/config_dynamic_perforation.yml @@ -0,0 +1,43 @@ +scales: + x: 4000 + y: 4000 + z: 300 + k: 50 +references: + x: 5000 + y: 5000 + z: 8375 + k: 50 +interpolation: + type: resinsight + measured_depth_step: 5.0 +connections: + type: resinsight + date: 2015-01-02 + formations_file: ./formations.lyr + perforations: + - well: INJ + formations: [0, 1, 2] + - well: PROD + dynamic: + - key: SOIL + min: 0 + max: 1 +wells: + - name: INJ + group: G1 + phase: GAS + platform: PLATFORM + cost: 0 + dogleg: 4 + - name: PROD + group: G1 + phase: OIL + platform: PLATFORM + cost: 0 + dogleg: 4 +platforms: + - name: PLATFORM + x: 5000 + y: 5000 + k: 50 diff --git a/tests/testdata/well_trajectory/resinsight/config_static_perforation.yml b/tests/testdata/well_trajectory/resinsight/config_static_perforation.yml new file mode 100644 index 0000000..361df5b --- /dev/null +++ b/tests/testdata/well_trajectory/resinsight/config_static_perforation.yml @@ -0,0 +1,43 @@ +scales: + x: 4000 + y: 4000 + z: 300 + k: 50 +references: + x: 5000 + y: 5000 + z: 8375 + k: 50 +interpolation: + type: resinsight + measured_depth_step: 5.0 +connections: + type: resinsight + date: 2015-01-02 + formations_file: ./formations.lyr + perforations: + - well: INJ + formations: [0, 1, 2] + - well: PROD + static: + - key: PORO + min: 0 + max: 1 +wells: + - name: INJ + group: G1 + phase: GAS + platform: PLATFORM + cost: 0 + dogleg: 4 + - name: PROD + group: G1 + phase: OIL + platform: PLATFORM + cost: 0 + dogleg: 4 +platforms: + - name: PLATFORM + x: 5000 + y: 5000 + k: 50