Skip to content

Commit

Permalink
Quickfix no validation for unintialized ensembles
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-eq committed Oct 16, 2024
1 parent 45b9a36 commit c3214c2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/ert/gui/simulation/evaluate_ensemble_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from ert.mode_definitions import EVALUATE_ENSEMBLE_MODE
from ert.run_models.evaluate_ensemble import EvaluateEnsemble
from ert.validation import RangeStringArgument
from ert.validation.rangestring import rangestring_to_list


@dataclass
Expand Down Expand Up @@ -68,9 +69,21 @@ def isConfigurationValid(self) -> bool:
return (
self._active_realizations_field.isValid()
and self._ensemble_selector.currentIndex() != -1
and bool(self._active_realizations_field.text())
and self._validate_selected_realization_exist()

Check failure on line 72 in src/ert/gui/simulation/evaluate_ensemble_panel.py

View workflow job for this annotation

GitHub Actions / type-checking (3.12)

Call to untyped function "_validate_selected_realization_exist" in typed context
)

def _validate_selected_realization_exist(self):

Check failure on line 75 in src/ert/gui/simulation/evaluate_ensemble_panel.py

View workflow job for this annotation

GitHub Actions / type-checking (3.12)

Function is missing a return type annotation
realizations = rangestring_to_list(self._active_realizations_field.text())
if len(realizations) < 1:
return False
selected_ensemble = self._ensemble_selector.selected_ensemble
for realization_index in realizations:
if not selected_ensemble._responses_exist_for_realization(
realization_index
):
return False
return True

def get_experiment_arguments(self) -> Arguments:
return Arguments(
mode=EVALUATE_ENSEMBLE_MODE,
Expand Down
18 changes: 17 additions & 1 deletion src/ert/gui/simulation/manual_update_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from ert.mode_definitions import MANUAL_UPDATE_MODE
from ert.run_models.manual_update import ManualUpdate
from ert.validation import ProperNameFormatArgument, RangeStringArgument
from ert.validation.rangestring import rangestring_to_list


@dataclass
Expand Down Expand Up @@ -93,9 +94,24 @@ def isConfigurationValid(self) -> bool:
return (
self._active_realizations_field.isValid()
and self._ensemble_selector.currentIndex() != -1
and bool(self._active_realizations_field.text())
and self._validate_selected_realization_exist()

Check failure on line 97 in src/ert/gui/simulation/manual_update_panel.py

View workflow job for this annotation

GitHub Actions / type-checking (3.12)

Call to untyped function "_validate_selected_realization_exist" in typed context
)

def _validate_selected_realization_exist(self):

Check failure on line 100 in src/ert/gui/simulation/manual_update_panel.py

View workflow job for this annotation

GitHub Actions / type-checking (3.12)

Function is missing a return type annotation
realizations = rangestring_to_list(self._active_realizations_field.text())
if len(realizations) < 1:
print("NO REALIZATIONS GIVEN")
return False
selected_ensemble = self._ensemble_selector.selected_ensemble
for realization_index in realizations:
if not selected_ensemble._responses_exist_for_realization(
realization_index
):
print(f"{realization_index=} does not exist!")
return False
print(f"VALID REALIZATIONS {realizations=}")
return True

def get_experiment_arguments(self) -> Arguments:
return Arguments(
mode=MANUAL_UPDATE_MODE,
Expand Down

0 comments on commit c3214c2

Please sign in to comment.