Skip to content

Commit

Permalink
MAINT: Drop separate FLUID_COLUMN variable (equinor#951)
Browse files Browse the repository at this point in the history
  • Loading branch information
tnatt authored and mferrera committed Jan 14, 2025
1 parent 78592d0 commit fd717d8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 17 deletions.
4 changes: 0 additions & 4 deletions src/fmu/dataio/export/_enums.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

from enum import Enum
from typing import Final


class InplaceVolumes:
Expand All @@ -23,9 +22,6 @@ class TableIndexColumns(str, Enum):
FACIES = "FACIES"
LICENSE = "LICENSE"

FLUID_COLUMN: Final = TableIndexColumns.FLUID
"""The column name and value used to indicate the index value for fluid type."""

class VolumetricColumns(str, Enum):
"""The value columns for an inplace volumes table."""

Expand Down
10 changes: 3 additions & 7 deletions src/fmu/dataio/export/rms/inplace_volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def _transform_and_add_fluid_column_to_table(
)

# add the fluid as column entry instead
fluid_table[_enums.InplaceVolumes.FLUID_COLUMN.value] = fluid
fluid_table[_TableIndexColumns.FLUID.value] = fluid

tables.append(fluid_table)

Expand Down Expand Up @@ -253,12 +253,8 @@ def _validate_table(self) -> None:
"Please update and rerun the volumetric job before export."
)

has_oil = (
"oil" in self._dataframe[_enums.InplaceVolumes.FLUID_COLUMN.value].values
)
has_gas = (
"gas" in self._dataframe[_enums.InplaceVolumes.FLUID_COLUMN.value].values
)
has_oil = "oil" in self._dataframe[_TableIndexColumns.FLUID.value].values
has_gas = "gas" in self._dataframe[_TableIndexColumns.FLUID.value].values

# check that one of oil and gas fluids are present
if not (has_oil or has_gas):
Expand Down
9 changes: 3 additions & 6 deletions tests/test_export_rms/test_export_rms_volumetrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,9 @@ def test_convert_table_from_legacy_to_standard_format(
pd.testing.assert_frame_equal(voltable_standard, exported_table)

# check that the fluid column exists and contains oil and gas
assert _enums.InplaceVolumes.FLUID_COLUMN in exported_table
assert set(exported_table[_enums.InplaceVolumes.FLUID_COLUMN].unique()) == {
"oil",
"gas",
"water",
}
fluid_col = _enums.InplaceVolumes.TableIndexColumns.FLUID.value
assert fluid_col in exported_table
assert set(exported_table[fluid_col].unique()) == {"oil", "gas", "water"}

# check the column order
assert list(exported_table.columns) == EXPECTED_COLUMN_ORDER
Expand Down

0 comments on commit fd717d8

Please sign in to comment.