From 04b4aab03f388b9577a002525738b7eb0acbab29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Therese=20Natter=C3=B8y?= <61694854+tnatt@users.noreply.github.com> Date: Mon, 19 Aug 2024 09:45:45 +0200 Subject: [PATCH] Add mean in tornado table VolumetricAnalysis (#1297) --- CHANGELOG.md | 5 +++++ setup.py | 2 +- webviz_subsurface/_components/tornado/_tornado_data.py | 3 +++ .../_volumetric_analysis/controllers/tornado_controllers.py | 6 +++++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 317b06360..a0f1abd7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [UNRELEASED] - YYYY-MM-DD +### Added +- [#1297](https://github.com/equinor/webviz-subsurface/pull/1297) - Added mean for mc sensitivities in the tornadotable in `VolumetricAnalysis`. + +## [0.2.30] - 2024-06-10 + ### Added - [#1293](https://github.com/equinor/webviz-subsurface/pull/1293) - Added automatic calculation of `STOIIP_TOTAL` / `GIIP_TOTAL` in `VolumetricAnalysis`. diff --git a/setup.py b/setup.py index 180aea7bb..1559b7ef2 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ "pytest-xdist", "pytest-forked", "selenium>=3.141", - "types-pkg-resources", + "types-setuptools", "types-pyyaml", ] diff --git a/webviz_subsurface/_components/tornado/_tornado_data.py b/webviz_subsurface/_components/tornado/_tornado_data.py index affc9b96f..1cecbd667 100644 --- a/webviz_subsurface/_components/tornado/_tornado_data.py +++ b/webviz_subsurface/_components/tornado/_tornado_data.py @@ -25,6 +25,9 @@ def __init__( self._cut_sensitivities_by_ref() self._sort_sensitivities_by_max() self._real_df = self._create_real_df(dframe) + self.mean_per_mc_sens = ( + dframe[dframe["SENSTYPE"] == "mc"].groupby("SENSNAME")["VALUE"].mean() + ) def _validate_input(self, dframe: pd.DataFrame) -> None: for col in self.REQUIRED_COLUMNS: diff --git a/webviz_subsurface/plugins/_volumetric_analysis/controllers/tornado_controllers.py b/webviz_subsurface/plugins/_volumetric_analysis/controllers/tornado_controllers.py index ce14fd89c..4e2957aad 100644 --- a/webviz_subsurface/plugins/_volumetric_analysis/controllers/tornado_controllers.py +++ b/webviz_subsurface/plugins/_volumetric_analysis/controllers/tornado_controllers.py @@ -359,12 +359,16 @@ def create_tornado_table( use_si_format=use_si_format, precision=4 if use_si_format else 3, ) + mean_col = "Mean (mc)" table_data = tornado_table.as_plotly_table for data in table_data: - data["Reference"] = tornado_data.reference_average + data[mean_col] = tornado_data.mean_per_mc_sens.get(data["Sensitivity"]) if group is not None: data[subplots] = group columns = create_table_columns(columns=[subplots]) if subplots is not None else [] columns.extend(tornado_table.columns) + columns.insert( + -3, create_table_columns(columns=[mean_col], use_si_format=[mean_col])[0] + ) return table_data, columns