Skip to content

Commit 3edaec8

Browse files
author
Øyvind Lind-Johansen
committed
Fixed pylint issue
1 parent 9bf2bcf commit 3edaec8

File tree

3 files changed

+32
-29
lines changed

3 files changed

+32
-29
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from ._datetime_utils import date_from_str, date_to_str
22
from ._simulation_time_series_onebyone_datamodel import (
33
SimulationTimeSeriesOneByOneDataModel,
4+
create_tornado_table,
45
create_vector_selector_data,
6+
get_tornado_data,
57
)

webviz_subsurface/plugins/_simulation_time_series_onebyone/_utils/_simulation_time_series_onebyone_datamodel.py

+25-24
Original file line numberDiff line numberDiff line change
@@ -150,18 +150,6 @@ def get_tornado_reference(sensitivities: List[str], existing_reference: str) ->
150150
return "rms_seed"
151151
return sensitivities[0]
152152

153-
def get_tornado_data(
154-
self, dframe: pd.DataFrame, response: str, selections: dict
155-
) -> TornadoData:
156-
dframe.rename(columns={response: "VALUE"}, inplace=True)
157-
return TornadoData(
158-
dframe=dframe,
159-
reference=selections["Reference"],
160-
response_name=response,
161-
scale=selections["Scale"],
162-
cutbyref=bool(selections["Remove no impact"]),
163-
)
164-
165153
def create_tornado_figure(
166154
self,
167155
tornado_data: TornadoData,
@@ -224,18 +212,6 @@ def create_realplot(self, tornado_data: TornadoData) -> go.Figure:
224212
)
225213
)
226214

227-
def create_tornado_table(
228-
self,
229-
tornado_data: TornadoData,
230-
use_si_format: bool,
231-
) -> Tuple[List[dict], List[dict]]:
232-
tornado_table = TornadoTable(
233-
tornado_data=tornado_data,
234-
use_si_format=use_si_format,
235-
precision=4 if use_si_format else 3,
236-
)
237-
return tornado_table.as_plotly_table, tornado_table.columns
238-
239215
def create_timeseries_figure(
240216
self,
241217
dframe: pd.DataFrame,
@@ -262,6 +238,31 @@ def create_timeseries_figure(
262238
).update_layout({"title": f"{vector}"})
263239

264240

241+
def get_tornado_data(
242+
dframe: pd.DataFrame, response: str, selections: dict
243+
) -> TornadoData:
244+
dframe.rename(columns={response: "VALUE"}, inplace=True)
245+
return TornadoData(
246+
dframe=dframe,
247+
reference=selections["Reference"],
248+
response_name=response,
249+
scale=selections["Scale"],
250+
cutbyref=bool(selections["Remove no impact"]),
251+
)
252+
253+
254+
def create_tornado_table(
255+
tornado_data: TornadoData,
256+
use_si_format: bool,
257+
) -> Tuple[List[dict], List[dict]]:
258+
tornado_table = TornadoTable(
259+
tornado_data=tornado_data,
260+
use_si_format=use_si_format,
261+
precision=4 if use_si_format else 3,
262+
)
263+
return tornado_table.as_plotly_table, tornado_table.columns
264+
265+
265266
def create_vector_selector_data(vector_names: list) -> list:
266267
vector_selector_data: list = []
267268
for vector in _get_non_historical_vector_names(vector_names):

webviz_subsurface/plugins/_simulation_time_series_onebyone/_views/_onebyone_view/_view.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
from ..._types import LineType
1313
from ..._utils import (
1414
SimulationTimeSeriesOneByOneDataModel,
15+
create_tornado_table,
1516
create_vector_selector_data,
1617
date_from_str,
1718
date_to_str,
19+
get_tornado_data,
1820
)
1921
from ._settings import GeneralSettings, Selections, SensitivityFilter, Visualization
2022
from ._view_elements import BottomVisualizationViewElement, GeneralViewElement
@@ -496,17 +498,15 @@ def _update_tornadoplot(
496498
),
497499
)
498500

499-
tornado_data = self._data_model.get_tornado_data(data, vector, selections)
501+
tornado_data = get_tornado_data(data, vector, selections)
500502
use_si_format = tornado_data.reference_average > 1000
501503
tornadofig = self._data_model.create_tornado_figure(
502504
tornado_data=tornado_data,
503505
selections=selections,
504506
use_si_format=use_si_format,
505507
title=f"Tornadoplot for {tornado_data.response_name} at {date} <br>",
506508
)
507-
table, columns = self._data_model.create_tornado_table(
508-
tornado_data, use_si_format
509-
)
509+
table, columns = create_tornado_table(tornado_data, use_si_format)
510510
return table, columns, tornadofig
511511

512512
@callback(
@@ -570,7 +570,7 @@ def _update_realplot(
570570
ensemble
571571
),
572572
)
573-
tornado_data = self._data_model.get_tornado_data(data, vector, selections)
573+
tornado_data = get_tornado_data(data, vector, selections)
574574

575575
return self._data_model.create_realplot(tornado_data)
576576

0 commit comments

Comments
 (0)