Skip to content

Commit

Permalink
BUG: E300 item IPHS in INTEHEAD is actually no. tracers (#814)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrivenaes authored Oct 26, 2022
1 parent 241b6dd commit f5f38a0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/xtgeo/grid3d/_ecl_inte_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ def num_active(self):
@property
def phases(self):
"""The phase system used for simulation"""
if "300" in str(self.simulator):
# item 14 in E300 runs is number of tracers, not IPHS; assume oil/wat/gas
return Phases.OIL_WATER_GAS
return self._optional_index_lookup(14, Phases)

@property
Expand Down
20 changes: 18 additions & 2 deletions tests/test_grid3d/test_ecl_inte_head.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import numpy as np
import pytest

from xtgeo.grid3d._ecl_inte_head import InteHead
from xtgeo.grid3d._ecl_inte_head import InteHead, Phases
from xtgeo.grid3d._ecl_output_file import Simulator, TypeOfGrid, UnitSystem


Expand All @@ -25,6 +24,23 @@ def test_intehead_non_standard_simulator():
assert intehead.simulator == Simulator.ECLIPSE_100


def test_intehead_iphs_when_e300():
intehead_values = [0] * 100
intehead_values[94] = 300 # simulator is Ecl 300
intehead_values[14] = 8 # 14 is IPHS code in E100 but no. tracers in E300, here 8
assert (
InteHead(intehead_values).phases == Phases.OIL_WATER_GAS
), "phases always OIL_WATER_GAS in Eclipse 300"


def test_intehead_iphs_fail_when_outsiderange_e100():
intehead_values = [0] * 100
intehead_values[94] = 100 # simulator is Ecl 100
intehead_values[14] = 8 # 14 is IPHS code in E100 but 8 is not a valid code
with pytest.raises(ValueError, match="not a valid Phases"):
InteHead(intehead_values).phases


def test_intehead_type_of_grid():
intehead = InteHead(np.full(shape=411, fill_value=3, dtype=np.int32))

Expand Down

0 comments on commit f5f38a0

Please sign in to comment.