Skip to content

Commit

Permalink
Bugfixes in VolumetricAnalysis (#1223)
Browse files Browse the repository at this point in the history
* Fix bug in statistics table in VolumetricAnalysis

* changelog
  • Loading branch information
tnatt committed Jun 7, 2023
1 parent 1b1bb17 commit bc3db13
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 16 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- [#1217](https://github.com/equinor/webviz-subsurface/pull/1217) - New plugin `SimulationTimeSeriesOneByOne`, meant to replace the old `ReservoirSimulationTimeSeriesOneByOne`. Uses the `.arrow` summary provider and is implemented with WLF (Webviz Layout Framework).

### Fixed
- [#1223](https://github.com/equinor/webviz-subsurface/pull/1223) - Fixed bug in the statistics table in `VolumetricAnalysis` that caused the selected 'Group by' columns to be merged if there were more than one.

## [0.2.19] - 2023-05-05

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,17 @@ def _update_page_custom(selections: dict, page_selected: str) -> tuple:
"No data left after filtering", style={"margin-top": "40px"}
)

df_for_figure = (
dframe
if not (selections["Plot type"] == "bar" and not "REAL" in selected_data)
else dframe.groupby([x for x in groups if x != "REAL"]).mean().reset_index()
)
bar_groups = [x for x in groups if x != "REAL"]

if (
selections["Plot type"] == "bar"
and bar_groups
and not "REAL" in selected_data
):
df_for_figure = dframe.groupby(bar_groups).mean().reset_index()
else:
df_for_figure = dframe

figure = (
create_figure(
plot_type=selections["Plot type"],
Expand Down Expand Up @@ -373,23 +379,27 @@ def make_tables(
continue
for name, df in df_groups:
values = df[response]
data = {
"Mean": values.mean(),
"Stddev": values.std(),
"P10": np.nanpercentile(values, 90),
"P90": np.nanpercentile(values, 10),
"Min": values.min(),
"Max": values.max(),
}

data = (
{
"Mean": values.mean(),
"Stddev": values.std(),
"P10": np.nanpercentile(values, 90),
"P90": np.nanpercentile(values, 10),
"Min": values.min(),
"Max": values.max(),
}
if not df[response].isnull().all()
else {}
)

if "FLUID_ZONE" not in groups:
data.update(
FLUID_ZONE=(" + ").join(selections["filters"]["FLUID_ZONE"])
)
for idx, group in enumerate(groups):
data[group] = (
name
if name is not None or name is not isinstance(name, str)
else list(name)[idx]
name if not isinstance(name, tuple) else list(name)[idx]
)
if response in volumemodel.volume_columns:
data["Response"] = response
Expand Down

0 comments on commit bc3db13

Please sign in to comment.