Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: Drop separate FLUID_COLUMN variable #951

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading