From 4cce8cdfe33e9c0945a32fbc8aed15878e92d939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Therese=20Natter=C3=B8y?= <61694854+tnatt@users.noreply.github.com> Date: Thu, 28 Apr 2022 15:29:24 +0200 Subject: [PATCH] Various bugfixes (#1014) * various bugfixes --- CHANGELOG.md | 4 ++++ .../_models/inplace_volumes_model.py | 5 ++++- webviz_subsurface/plugins/_bhp_qc.py | 1 + .../plugins/_parameter_response_correlation.py | 1 + .../plugins/_swatinit_qc/_business_logic.py | 4 ++++ .../plugins/_swatinit_qc/_figures.py | 3 ++- .../volume_validator_and_combinator.py | 15 ++++++++++----- 7 files changed, 26 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ddca5540..d28fc84cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#938](https://github.com/equinor/webviz-subsurface/pull/938) - `ProdMisfit` - New plugin for well production misfit visualization. Features visualization of production misfit at selected dates, production coverage at selected dates and heatmap representation of ensemble mean misfit for selected dates. - [#1013](https://github.com/equinor/webviz-subsurface/pull/1013) - `MapViewerFMU` - Added option to specify the folder where maps are located (relative to runpath in each realization). +### Fixed + +- [#1014](https://github.com/equinor/webviz-subsurface/pull/1014) - `ParameterResponseCorrelation` and `BhpQc` - fix bug in range slider. `VolumetricAnalysis` - prevent "Totals" volumes (if present) beeing included in the sum when comparing static and dynamic volumes, and do not include non-numeric columns as volumetric responses. + ## [0.2.12] - 2022-04-07 ### Added diff --git a/webviz_subsurface/_models/inplace_volumes_model.py b/webviz_subsurface/_models/inplace_volumes_model.py index 3715ced42..50f94b21c 100644 --- a/webviz_subsurface/_models/inplace_volumes_model.py +++ b/webviz_subsurface/_models/inplace_volumes_model.py @@ -4,6 +4,7 @@ import numpy as np import pandas as pd +from pandas.api.types import is_numeric_dtype from .ensemble_set_model import EnsembleSetModel from .parameter_model import ParametersModel @@ -164,7 +165,9 @@ def volume_columns(self) -> List[str]: return [ x for x in self._dataframe - if x not in self.selectors and x not in self.property_columns + if x not in self.selectors + and x not in self.property_columns + and is_numeric_dtype(self._dataframe[x]) ] @property diff --git a/webviz_subsurface/plugins/_bhp_qc.py b/webviz_subsurface/plugins/_bhp_qc.py index a65b61487..24440a3e0 100644 --- a/webviz_subsurface/plugins/_bhp_qc.py +++ b/webviz_subsurface/plugins/_bhp_qc.py @@ -190,6 +190,7 @@ def layout(self) -> wcc.FlexBox: id=self.uuid("n_wells"), min=1, max=len(self.wells), + step=1, value=min(10, len(self.wells)), marks={1: 1, len(self.wells): len(self.wells)}, ), diff --git a/webviz_subsurface/plugins/_parameter_response_correlation.py b/webviz_subsurface/plugins/_parameter_response_correlation.py index f8a7f73b2..2eb1608f3 100644 --- a/webviz_subsurface/plugins/_parameter_response_correlation.py +++ b/webviz_subsurface/plugins/_parameter_response_correlation.py @@ -308,6 +308,7 @@ def control_layout(self): id=self.uuid("max-params"), min=1, max=max_params, + step=1, marks={1: "1", max_params: str(max_params)}, value=max_params, ), diff --git a/webviz_subsurface/plugins/_swatinit_qc/_business_logic.py b/webviz_subsurface/plugins/_swatinit_qc/_business_logic.py index 3a1e40e89..ea4ce335b 100644 --- a/webviz_subsurface/plugins/_swatinit_qc/_business_logic.py +++ b/webviz_subsurface/plugins/_swatinit_qc/_business_logic.py @@ -57,6 +57,10 @@ def __init__( self.faultlines_df = read_csv(faultlines) if faultlines else None if ensemble is not None: + if isinstance(ensemble, list): + raise TypeError( + 'Incorrent argument type, "ensemble" must be a string instead of a list' + ) if realization is None: raise ValueError('Incorrent arguments, "realization" must be specified') diff --git a/webviz_subsurface/plugins/_swatinit_qc/_figures.py b/webviz_subsurface/plugins/_swatinit_qc/_figures.py index 5d591eb42..223810de9 100644 --- a/webviz_subsurface/plugins/_swatinit_qc/_figures.py +++ b/webviz_subsurface/plugins/_swatinit_qc/_figures.py @@ -257,7 +257,8 @@ def add_contacts_to_plot(self) -> None: if contact in self.dframe and self.dframe["EQLNUM"].nunique() == 1: # contacts are assumed constant in the dataframe value = self.dframe[contact].values[0] - if value not in [0, 1000]: + # do not include dummy contacts (shallower than the dataset) + if value > self.dframe["Z"].min(): self._figure.add_hline( value, line={"color": "black", "dash": "dash", "width": 1.5}, diff --git a/webviz_subsurface/plugins/_volumetric_analysis/volume_validator_and_combinator.py b/webviz_subsurface/plugins/_volumetric_analysis/volume_validator_and_combinator.py index 369bbfd12..08519bbb3 100644 --- a/webviz_subsurface/plugins/_volumetric_analysis/volume_validator_and_combinator.py +++ b/webviz_subsurface/plugins/_volumetric_analysis/volume_validator_and_combinator.py @@ -49,8 +49,10 @@ def __init__(self, volumes_table: pd.DataFrame, fipfile: Path = None): self.disjoint_set_df = ( fipmapper.FipMapper(yamlfile=fipfile).disjoint_sets() if fipfile else None ) - self.dframe = self.validate_and_combine_sources(volumes_table) - self.drop_rows_with_totals_from_selectors() + + self.dframe = self.validate_and_combine_sources( + self.drop_rows_with_totals_from_selectors(volumes_table) + ) self.volume_type = self.set_volumetric_type() if self.volume_type == "mixed": @@ -218,7 +220,10 @@ def drop_total_columns(self) -> None: ) self.dframe.drop(columns=total_columns, inplace=True) - def drop_rows_with_totals_from_selectors(self) -> None: + @staticmethod + def drop_rows_with_totals_from_selectors(dframe: pd.DataFrame) -> pd.DataFrame: """Drop rows containing total volumes ("Totals") if present""" - for sel in [col for col in self.VALID_STATIC_SELECTORS if col in self.dframe]: - self.dframe = self.dframe.loc[self.dframe[sel] != "Totals"] + selectors = [col for col in ["ZONE", "REGION", "FACIES"] if col in dframe] + for sel in selectors: + dframe = dframe.loc[dframe[sel] != "Totals"] + return dframe