Skip to content

Commit

Permalink
Allow initialization without field vectors (#599)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans Kallekleiv authored Mar 26, 2021
1 parent 5a0b97b commit b6303fc
Show file tree
Hide file tree
Showing 9 changed files with 301 additions and 190 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [UNRELEASED] - YYYY-MM-DD
### Changed
- [#586](https://github.com/equinor/webviz-subsurface/pull/586) - Added phase ratio vs pressure and density vs pressure plots. Added unit and density functions to PVT library. Refactored code and added checklist for plots to be viewed in PVT plot plugin. Improved the layout.
- [#599](https://github.com/equinor/webviz-subsurface/pull/599) - Fixed an issue in ParameterAnalysis where the plugin did not initialize without FIELD vectors

### Fixed
- [#602](https://github.com/equinor/webviz-subsurface/pull/602) - Prevent calculation of data for download at initialisation of ReservoirSimulationTimeSeries.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
from typing import Callable

import dash
from dash.dependencies import Input, Output, State
import dash_table
import webviz_core_components as wcc

from ..models import ParametersModel


def parameter_qc_controller(parent, app):
def parameter_qc_controller(
app: dash.Dash, get_uuid: Callable, parametermodel: ParametersModel
):
@app.callback(
Output(parent.uuid("property-qc-wrapper"), "children"),
Input({"id": parent.uuid("ensemble-selector"), "tab": "qc"}, "value"),
Input({"id": parent.uuid("delta-ensemble-selector"), "tab": "qc"}, "value"),
Output(get_uuid("property-qc-wrapper"), "children"),
Input({"id": get_uuid("ensemble-selector"), "tab": "qc"}, "value"),
Input({"id": get_uuid("delta-ensemble-selector"), "tab": "qc"}, "value"),
Input(
{"id": parent.uuid("filter-parameter"), "tab": "qc"},
{"id": get_uuid("filter-parameter"), "tab": "qc"},
"value",
),
Input(parent.uuid("property-qc-plot-type"), "value"),
Input(get_uuid("property-qc-plot-type"), "value"),
)
def _update_bars(ensemble, delta_ensemble, parameters, plot_type):
"""Callback to switch visualization between table and distribution plots"""
parameters = parameters if isinstance(parameters, list) else [parameters]
ensembles = [ensemble, delta_ensemble]

if plot_type == "table":
columns, dframe = parent.pmodel.make_statistics_table(
columns, dframe = parametermodel.make_statistics_table(
ensembles=ensembles, parameters=parameters
)
return dash_table.DataTable(
Expand All @@ -35,10 +42,10 @@ def _update_bars(ensemble, delta_ensemble, parameters, plot_type):
filter_action="native",
)
return wcc.Graph(
id=parent.uuid("property-qc-graph"),
id=get_uuid("property-qc-graph"),
config={"displayModeBar": False},
style={"height": "75vh"},
figure=parent.pmodel.make_grouped_plot(
figure=parametermodel.make_grouped_plot(
ensembles=ensembles,
parameters=parameters,
plot_type=plot_type,
Expand All @@ -47,28 +54,28 @@ def _update_bars(ensemble, delta_ensemble, parameters, plot_type):

@app.callback(
Output(
{"id": parent.uuid("filter-parameter"), "tab": "qc"},
{"id": get_uuid("filter-parameter"), "tab": "qc"},
"options",
),
Output(
{"id": parent.uuid("filter-parameter"), "tab": "qc"},
{"id": get_uuid("filter-parameter"), "tab": "qc"},
"value",
),
Input(parent.uuid("delta-sort"), "value"),
Input({"id": parent.uuid("ensemble-selector"), "tab": "qc"}, "value"),
Input({"id": parent.uuid("delta-ensemble-selector"), "tab": "qc"}, "value"),
Input(get_uuid("delta-sort"), "value"),
Input({"id": get_uuid("ensemble-selector"), "tab": "qc"}, "value"),
Input({"id": get_uuid("delta-ensemble-selector"), "tab": "qc"}, "value"),
State(
{"id": parent.uuid("filter-parameter"), "tab": "qc"},
{"id": get_uuid("filter-parameter"), "tab": "qc"},
"value",
),
)
def _update_parameters(sortby, ensemble, delta_ensemble, current_params):
"""Callback to sort parameters based on selection"""
parent.pmodel.sort_parameters(
parametermodel.sort_parameters(
ensemble=ensemble,
delta_ensemble=delta_ensemble,
sortby=sortby,
)
return [
{"label": i, "value": i} for i in parent.pmodel.parameters
{"label": i, "value": i} for i in parametermodel.parameters
], current_params
Loading

0 comments on commit b6303fc

Please sign in to comment.