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

ENH: Set NET equal BULK if missing in inplace_volumes (#948) #950

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
2 changes: 1 addition & 1 deletion src/fmu/dataio/_products/inplace_volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class InplaceVolumesResultRow(BaseModel):
LICENSE: Optional[str] = Field(default=None)

BULK: float = Field(ge=0.0)
NET: Optional[float] = Field(default=None, ge=0.0)
NET: float = Field(ge=0.0)
PORV: float = Field(ge=0.0)
HCPV: Optional[float] = Field(default=None, ge=0.0)
STOIIP: Optional[float] = Field(default=None, ge=0.0)
Expand Down
1 change: 1 addition & 0 deletions src/fmu/dataio/export/_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def required_value_columns() -> list[str]:
"""Returns a list of the value columns."""
return [
InplaceVolumes.VolumetricColumns.BULK.value,
InplaceVolumes.VolumetricColumns.NET.value,
InplaceVolumes.VolumetricColumns.PORV.value,
InplaceVolumes.VolumetricColumns.HCPV.value,
]
Expand Down
12 changes: 12 additions & 0 deletions src/fmu/dataio/export/rms/inplace_volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,17 @@ def _add_missing_columns_to_table(table: pd.DataFrame) -> pd.DataFrame:
table[col] = np.nan
return table

@staticmethod
def _set_net_equal_to_bulk_if_missing_in_table(table: pd.DataFrame) -> pd.DataFrame:
"""
Add a NET column to the table equal to the BULK column if NET is missing,
since the absence implies a net-to-gross ratio of 1.
"""
if _VolumetricColumns.NET.value not in table:
_logger.debug("NET column missing, setting NET equal BULK...")
table[_VolumetricColumns.NET.value] = table[_VolumetricColumns.BULK.value]
return table

@staticmethod
def _set_table_column_order(table: pd.DataFrame) -> pd.DataFrame:
"""Set the column order in the table."""
Expand Down Expand Up @@ -230,6 +241,7 @@ def _convert_table_from_legacy_to_standard_format(
]
table = self._compute_water_zone_volumes_from_totals(table)
table = self._transform_and_add_fluid_column_to_table(table, table_index)
table = self._set_net_equal_to_bulk_if_missing_in_table(table)
table = self._add_missing_columns_to_table(table)
return self._set_table_column_order(table)

Expand Down
Loading
Loading