From b4e3de4d79a82f906e0ffc977da20a6e50c94bdd Mon Sep 17 00:00:00 2001 From: Hans Kallekleiv Date: Wed, 1 Apr 2020 10:07:33 +0200 Subject: [PATCH] Inplace volumetrics: Initialize with boxplot if multiple ensembles are present (#294) --- webviz_subsurface/plugins/_inplace_volumes.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/webviz_subsurface/plugins/_inplace_volumes.py b/webviz_subsurface/plugins/_inplace_volumes.py index 5f441f1a3..3868a08f5 100644 --- a/webviz_subsurface/plugins/_inplace_volumes.py +++ b/webviz_subsurface/plugins/_inplace_volumes.py @@ -101,6 +101,12 @@ def __init__( self.uid = uuid4() self.selectors_id = {x: str(uuid4()) for x in self.selectors} self.plotly_theme = app.webviz_settings["theme"].plotly_theme + if len(self.volumes["ENSEMBLE"].unique()) > 1: + self.initial_plot = "Box plot" + self.initial_group = "ENSEMBLE" + else: + self.initial_plot = "Per realization" + self.initial_group = None self.set_callbacks(app) def ids(self, element): @@ -287,7 +293,7 @@ def plot_options_layout(self): dcc.Dropdown( id=self.ids("response"), options=[ - {"label": volume_description(i), "value": i,} + {"label": volume_description(i), "value": i} for i in self.responses ], value=self.initial_response @@ -307,7 +313,7 @@ def plot_options_layout(self): options=[ {"label": i, "value": i} for i in self.plot_types ], - value="Per realization", + value=self.initial_plot, clearable=False, ), ] @@ -323,7 +329,7 @@ def plot_options_layout(self): {"label": i.lower().capitalize(), "value": i} for i in self.selectors ], - value=None, + value=self.initial_group, placeholder="Not grouped", ), ] @@ -348,7 +354,7 @@ def layout(self): style={"height": 400}, children=wcc.Graph(id=self.ids("graph")), ), - html.Div(dash_table.DataTable(id=self.ids("table"),)), + html.Div(dash_table.DataTable(id=self.ids("table"))), ] ), html.Div( @@ -501,10 +507,7 @@ def table_columns(response): ] for col in columns: try: - col["format"]["locale"]["symbol"] = [ - "", - f"{volume_unit(response)}", - ] + col["format"]["locale"]["symbol"] = ["", f"{volume_unit(response)}"] except KeyError: pass return columns