diff --git a/webviz_subsurface/_models/inplace_volumes_model.py b/webviz_subsurface/_models/inplace_volumes_model.py index 63b0fc2c9..e28107f90 100644 --- a/webviz_subsurface/_models/inplace_volumes_model.py +++ b/webviz_subsurface/_models/inplace_volumes_model.py @@ -36,6 +36,8 @@ class InplaceVolumesModel: "GIIP", "ASSOCIATEDOIL", "ASSOCIATEDGAS", + "STOIIP_TOTAL", + "GIIP_TOTAL", "BULK", "NET", "PORV", @@ -93,6 +95,16 @@ def __init__( self._dataframe, self.pmodel.sens_df, on=["ENSEMBLE", "REAL"] ) + # create HC_TOTAL columns + if "STOIIP" in self._dataframe and "ASSOCIATEDOIL" in self._dataframe: + self._dataframe["STOIIP_TOTAL"] = self._dataframe["STOIIP"].fillna( + 0 + ) + self._dataframe["ASSOCIATEDOIL"].fillna(0) + if "GIIP" in self._dataframe and "ASSOCIATEDGAS" in self._dataframe: + self._dataframe["GIIP_TOTAL"] = self._dataframe["GIIP"].fillna( + 0 + ) + self._dataframe["ASSOCIATEDGAS"].fillna(0) + # set column order colorder = self.selectors + self.VOLCOL_ORDER self._dataframe = self._dataframe[ diff --git a/webviz_subsurface/plugins/_volumetric_analysis/controllers/comparison_controllers.py b/webviz_subsurface/plugins/_volumetric_analysis/controllers/comparison_controllers.py index 577e5994c..b9266ff37 100644 --- a/webviz_subsurface/plugins/_volumetric_analysis/controllers/comparison_controllers.py +++ b/webviz_subsurface/plugins/_volumetric_analysis/controllers/comparison_controllers.py @@ -103,7 +103,8 @@ def comparison_callback( responses = [selections["Response"]] + [ col for col in volumemodel.responses - if col not in volumemodel.hc_responses and col != selections["Response"] + if col not in volumemodel.hc_responses + ["STOIIP_TOTAL", "GIIP_TOTAL"] + and col != selections["Response"] ] df = create_comparison_df( volumemodel, @@ -132,18 +133,25 @@ def comparison_callback( ) # Waterfall plot - require_response = selections["Response"] in ("STOIIP", "GIIP") - required_columns = ["BULK", "PORO", "SW"] - required_columns.append("BO" if selections["Response"] == "STOIIP" else "BG") - if not require_response or all(col in df for col in required_columns): - return html.Div( - "Waterfall plot is only available for analyzing STOIIP/GIIP changes from static" - f"sources containing all {required_columns=}." + compatible = selections["Response"] in ("STOIIP", "GIIP") + required_columns = ["BULK", "PORO", "SW"] + [ + "BO" if selections["Response"] == "STOIIP" else "BG" + ] + for required_col in required_columns: + if not any(col.startswith(required_col) for col in df.columns): + compatible = False + + if compatible: + return waterfall_plot_layout( + selections=selections, + filter_info="SOURCE" if compare_on != "SOURCE" else "ENSEMBLE", + figures=create_waterfall_figures( + df, selections, groupby, max_figures=10 + ), ) - return waterfall_plot_layout( - selections=selections, - filter_info="SOURCE" if compare_on != "SOURCE" else "ENSEMBLE", - figures=create_waterfall_figures(df, selections, groupby, max_figures=10), + return html.Div( + "Waterfall plot is only available for analyzing STOIIP/GIIP changes from static " + f"sources containing all {required_columns=}." ) if compare_on == "SOURCE" or "REAL" in groupby: diff --git a/webviz_subsurface/plugins/_volumetric_analysis/volumetric_analysis.py b/webviz_subsurface/plugins/_volumetric_analysis/volumetric_analysis.py index ea16943aa..f75bbd7c5 100644 --- a/webviz_subsurface/plugins/_volumetric_analysis/volumetric_analysis.py +++ b/webviz_subsurface/plugins/_volumetric_analysis/volumetric_analysis.py @@ -199,6 +199,10 @@ def __init__( volumes_table=volumes_table, fipfile=get_path(self.fipfile) if self.fipfile else None, ) + if self.fipfile and vcomb.dframe.empty: + raise ValueError( + "Not possible to obtain any results using the provided fipfile." + ) self.disjoint_set_df = vcomb.disjoint_set_df self.volmodel = InplaceVolumesModel( volumes_table=vcomb.dframe,