Skip to content

Commit

Permalink
Add check for date in connections
Browse files Browse the repository at this point in the history
  • Loading branch information
verveerpj committed Oct 28, 2024
1 parent 830b3c3 commit 974266c
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/everest_models/jobs/fm_well_trajectory/resinsight.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ def _find_time_step(
time_step_num = ts_idx
logger.info(f"Timestep number for the date {date_simgrid}: {time_step_num}")
break
if time_step_num is None:
raise RuntimeError(f"Connections error: date not found in restart file: {date}")
return time_step_num


Expand All @@ -160,7 +162,7 @@ def _create_tracks(
case: rips.Case,
well_path: rips.WellPath,
well_log_plot: rips.WellLogPlot,
time_step_num: Optional[int] = None,
time_step_num: int,
) -> None:
for property in properties:
track = well_log_plot.new_well_log_track(
Expand Down
14 changes: 14 additions & 0 deletions tests/jobs/well_trajectory/test_well_trajectory_resinsight.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,17 @@ def test_well_trajectory_resinsight_main_entry_point_no_mlt_dynamic_perforation(
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_missing_date(
copy_testdata_tmpdir,
):
copy_testdata_tmpdir(Path(TEST_DATA) / "resinsight")
for path in Path.cwd().glob("mlt_*.json"):
path.unlink()
with pytest.raises(
RuntimeError,
match="Connections error: date not found in restart file: 2015-01-03",
):
main_entry_point("-c config_missing_date.yml -E SPE1CASE1".split())
43 changes: 43 additions & 0 deletions tests/testdata/well_trajectory/resinsight/config_missing_date.yml
Original file line number Diff line number Diff line change
@@ -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-03
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

0 comments on commit 974266c

Please sign in to comment.