Skip to content

Commit

Permalink
Rework well trajectory tests
Browse files Browse the repository at this point in the history
  • Loading branch information
verveerpj committed Jul 12, 2024
1 parent b0d6a4c commit ed7fed4
Show file tree
Hide file tree
Showing 77 changed files with 3,443 additions and 19 deletions.
21 changes: 6 additions & 15 deletions tests/jobs/well_trajectory/test_read_trajectories.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import shutil
from pathlib import Path

import numpy as np
Expand Down Expand Up @@ -131,7 +130,7 @@ def test_read_trajectories_no_kickoff(copy_testdata_tmpdir):


def test_read_laterals_orphaned_branches(copy_testdata_tmpdir):
copy_testdata_tmpdir(Path(TEST_DATA) / "spe1case1_mlt")
copy_testdata_tmpdir(Path(TEST_DATA) / "read_laterals")
config = ConfigSchema.model_validate(load_yaml("config.yml"))
mlt_p1_z = load_json("mlt_p1_z.json")
mlt_p1_z["DUMMY"] = {"1": 0.0}
Expand All @@ -143,7 +142,7 @@ def test_read_laterals_orphaned_branches(copy_testdata_tmpdir):


def test_read_laterals_missing_files(copy_testdata_tmpdir):
copy_testdata_tmpdir(Path(TEST_DATA) / "spe1case1_mlt")
copy_testdata_tmpdir(Path(TEST_DATA) / "read_laterals")
config = ConfigSchema.model_validate(load_yaml("config.yml"))
Path("mlt_p2_b.json").unlink()
Path("mlt_p3_x.json").unlink()
Expand All @@ -155,7 +154,7 @@ def test_read_laterals_missing_files(copy_testdata_tmpdir):


def test_read_laterals_missing_wells(copy_testdata_tmpdir):
copy_testdata_tmpdir(Path(TEST_DATA) / "spe1case1_mlt")
copy_testdata_tmpdir(Path(TEST_DATA) / "read_laterals")
config = ConfigSchema.model_validate(load_yaml("config.yml"))
mlt_p2_b = load_json("mlt_p2_b.json")
mlt_p3_x = load_json("mlt_p3_x.json")
Expand All @@ -171,7 +170,7 @@ def test_read_laterals_missing_wells(copy_testdata_tmpdir):


def test_read_laterals_missing_branches(copy_testdata_tmpdir):
copy_testdata_tmpdir(Path(TEST_DATA) / "spe1case1_mlt")
copy_testdata_tmpdir(Path(TEST_DATA) / "read_laterals")
config = ConfigSchema.model_validate(load_yaml("config.yml"))
mlt_p2_b = load_json("mlt_p2_b.json")
mlt_p3_x = load_json("mlt_p3_x.json")
Expand All @@ -187,8 +186,7 @@ def test_read_laterals_missing_branches(copy_testdata_tmpdir):


def test_read_laterals_branch_not_on_well(copy_testdata_tmpdir):
copy_testdata_tmpdir(Path(TEST_DATA) / "spe1case1_mlt")
shutil.copytree("expected/wellpaths", "wellpaths")
copy_testdata_tmpdir(Path(TEST_DATA) / "read_laterals")
config = ConfigSchema.model_validate(load_yaml("config.yml"))
mlt_p1_z = load_json("mlt_p1_z.json")
mlt_p1_z["INJ"]["1"] = 1.0
Expand All @@ -197,15 +195,8 @@ def test_read_laterals_branch_not_on_well(copy_testdata_tmpdir):
read_laterals(config.scales, config.references, config.wells)


def test_read_laterals_no_branches(copy_testdata_tmpdir):
copy_testdata_tmpdir(Path(TEST_DATA) / "spe1case1")
config = ConfigSchema.model_validate(load_yaml("config.yml"))
assert read_laterals(config.scales, config.references, config.wells) == {}


def test_read_laterals(copy_testdata_tmpdir):
copy_testdata_tmpdir(Path(TEST_DATA) / "spe1case1_mlt")
shutil.copytree("expected/wellpaths", "wellpaths")
copy_testdata_tmpdir(Path(TEST_DATA) / "read_laterals")
config = ConfigSchema.model_validate(load_yaml("config.yml"))
laterals = read_laterals(config.scales, config.references, config.wells)

Expand Down
2 changes: 1 addition & 1 deletion tests/jobs/well_trajectory/test_well_trajectory_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_parameters_config_simple(path_test_data):


def test_parameters_config_resinsight(copy_testdata_tmpdir):
copy_testdata_tmpdir(Path(TEST_DATA) / "spe1case1")
copy_testdata_tmpdir(Path(TEST_DATA) / "resinsight")
config = load_yaml("config.yml")
ConfigSchema.model_validate(config)

Expand Down
6 changes: 3 additions & 3 deletions tests/jobs/well_trajectory/test_well_trajectory_resinsight.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_start_resinsight(caplog):
def test_well_trajectory_resinsight_main_entry_point(
well_trajectory_arguments, copy_testdata_tmpdir
):
copy_testdata_tmpdir(Path(TEST_DATA) / "spe1case1")
copy_testdata_tmpdir(Path(TEST_DATA) / "resinsight")
main_entry_point(well_trajectory_arguments)

for expected in Path("expected").glob("**/*"):
Expand All @@ -51,7 +51,7 @@ def test_well_trajectory_resinsight_main_entry_point(
def test_well_trajectory_resinsight_main_entry_point_lint(
well_trajectory_arguments, copy_testdata_tmpdir
):
copy_testdata_tmpdir(Path(TEST_DATA) / "spe1case1")
copy_testdata_tmpdir(Path(TEST_DATA) / "resinsight")
with pytest.raises(SystemExit):
main_entry_point([*well_trajectory_arguments, "--lint"])

Expand All @@ -64,7 +64,7 @@ def test_well_trajectory_resinsight_main_entry_point_lint(
def test_well_trajectory_resinsight_main_entry_point_mlt(
well_trajectory_arguments, copy_testdata_tmpdir
):
copy_testdata_tmpdir(Path(TEST_DATA) / "spe1case1_mlt")
copy_testdata_tmpdir(Path(TEST_DATA) / "resinsight_mlt")
main_entry_point(well_trajectory_arguments)

for expected in Path("expected").glob("**/*"):
Expand Down
35 changes: 35 additions & 0 deletions tests/testdata/well_trajectory/read_laterals/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
scales:
x: 10000
y: 10000
z: 100
k: 50
references:
x: 5000
y: 5000
z: 8375
k: 50
interpolation:
type: resinsight
measured_depth_step: 5.0
wells:
- name: INJ
group: G1
phase: GAS
platform: INJ
cost: 0
dogleg: 4
- name: PROD
group: G1
phase: OIL
platform: PROD
cost: 0
dogleg: 4
platforms:
- name: INJ
x: 2500
y: 2500
k: 50
- name: PROD
x: 7500
y: 7500
k: 50
Loading

0 comments on commit ed7fed4

Please sign in to comment.