Skip to content

Commit

Permalink
Sensitivity filter in RftPlotter parameter response view (#1211)
Browse files Browse the repository at this point in the history
* Param respone view always added, sensitivity filter and some small fixes

* changelog entry

* Fixed CHANGELOG

* typing error in changelog

---------

Co-authored-by: Øyvind Lind-Johansen <[email protected]>
  • Loading branch information
lindjoha and Øyvind Lind-Johansen authored Apr 24, 2023
1 parent b1ce253 commit ce25837
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 12 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [UNRELEASED] - YYYY-MM-DD

### Changed

- [#1211](https://github.com/equinor/webviz-subsurface/pull/1211) - `RftPlotter`: Parameter response view always displayed, also for sensitivity ensembles. Instead it is now possible to filter on SENSNAME.

### Added
- [#1207](https://github.com/equinor/webviz-subsurface/pull/1207) - New functionality in `ParameterAnalysis`: observations, resampling frequency and sensitivity filter.

## [0.2.18] - 2023-04-12

### Changed
Expand All @@ -17,7 +24,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added
- [#1199](https://github.com/equinor/webviz-subsurface/pull/1199) - Added more statistical options to the WellOverview tab in `WellAnalysis`, and the possibility to see injection rates.
- [#1207](https://github.com/equinor/webviz-subsurface/pull/1207) - New functionality in `ParameterAnalysis`: observations, resampling frequency and sensitivity filter.

## [0.2.17] - 2023-01-18

Expand Down
7 changes: 3 additions & 4 deletions webviz_subsurface/plugins/_rft_plotter/_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,9 @@ def __init__(
self.add_view(MapView(self._datamodel), self.Ids.MAP_VIEW)
self.add_view(MisfitPerRealView(self._datamodel), self.Ids.MISFIT_PER_REAL_VIEW)
self.add_view(SimVsObsView(self._datamodel), self.Ids.SIM_VS_OBS_VIEW)
if not self._datamodel.param_model.sensrun:
self.add_view(
ParameterResponseView(self._datamodel), self.Ids.PARAMETER_RESPONSE_VIEW
)
self.add_view(
ParameterResponseView(self._datamodel), self.Ids.PARAMETER_RESPONSE_VIEW
)

def add_webvizstore(self) -> List[Tuple[Callable, List[Dict]]]:
return self._datamodel.webviz_store
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def add_formation(self, df: pd.DataFrame, fill_color: bool = True) -> None:
"name": row["ZONE"],
"y0": row[top_col],
"y1": row[base_col],
"line": dict(color="#646567", width=1.0),
"line": {"color": "#646567", "width": 1.0},
"fillcolor": formation_colors[
list(df["ZONE"].unique()).index(row["ZONE"])
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(self, ertdf: pd.DataFrame, ensemble: str, zones: List[str]) -> None
self._ertdf = (
ertdf.loc[(ertdf["ENSEMBLE"] == ensemble) & (ertdf["ZONE"].isin(zones))]
.groupby(["WELL", "DATE", "ENSEMBLE"])
.aggregate("mean")
.mean(numeric_only=False)
.reset_index()
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ class ParameterFilterSettings(SettingsGroupABC):
class Ids(StrEnum):
PARAM_FILTER = "param-filter"

def __init__(self, parameter_df: pd.DataFrame, mc_ensembles: List[str]) -> None:
def __init__(self, parameter_df: pd.DataFrame, ensembles: List[str]) -> None:
super().__init__("Parameter Filter")
self._parameter_df = parameter_df
self._mc_ensembles = mc_ensembles
self._ensembles = ensembles

def layout(self) -> List[Component]:
return ParameterFilter(
uuid=self.register_component_unique_id(self.Ids.PARAM_FILTER),
dframe=self._parameter_df[
self._parameter_df["ENSEMBLE"].isin(self._mc_ensembles)
self._parameter_df["ENSEMBLE"].isin(self._ensembles)
].copy(),
reset_on_ensemble_update=True,
display_header=False,
include_sens_filter=True,
).layout
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def layout(self) -> List[Component]:
label="Parameter",
id=self.register_component_unique_id(self.Ids.PARAM),
options=[{"label": param, "value": param} for param in self._params],
clearable=False,
clearable=True,
value=None,
),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, datamodel: RftPlotterDataModel) -> None:
self.add_settings_group(
ParameterFilterSettings(
parameter_df=self._datamodel.param_model.dataframe,
mc_ensembles=self._datamodel.param_model.mc_ensembles,
ensembles=self._datamodel.param_model.ensembles,
),
self.Ids.PARAMETER_FILTER,
)
Expand Down Expand Up @@ -220,6 +220,10 @@ def _update_paramresp_graphs(
# This happens if there are multiple ensembles and one of the ensembles
# doesn't have non-constant parameters.
return ["The selected ensemble has no non-constant parameters."] * 3
if df.shape[0] <= 1:
# This happens if f.ex it is filtered on a sensitivity with only one
# realization.
return ["Too few realizations to calculate correlations"] * 3

if corrtype == CorrType.SIM_VS_PARAM or param is None:
corrseries = correlate(df[ens_params + [current_key]], current_key)
Expand Down

0 comments on commit ce25837

Please sign in to comment.