Skip to content

Commit

Permalink
ENH: Set NET equal BULK if missing in inplace_volumes (equinor#948)
Browse files Browse the repository at this point in the history
  • Loading branch information
tnatt committed Jan 3, 2025
1 parent e5ca3bf commit cf7176a
Show file tree
Hide file tree
Showing 4 changed files with 543 additions and 505 deletions.
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
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

0 comments on commit cf7176a

Please sign in to comment.