Skip to content

Commit

Permalink
Extra check
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanDeHoop committed Dec 17, 2024
1 parent 2c867a9 commit 9e0cd23
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/everest/config/model_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from ert.config import ConfigWarning

EMPTY_MODEL_CONFIG_WARNING = "`model` cannot be empty, it needs to contain `realizations` (a list of non-negative integers with length > 0)"


class ModelConfig(BaseModel, extra="forbid"): # type: ignore
realizations: list[NonNegativeInt] = Field(
Expand All @@ -27,6 +29,9 @@ class ModelConfig(BaseModel, extra="forbid"): # type: ignore
@model_validator(mode="before")
@classmethod
def remove_deprecated(cls, values):
if values is None:
raise ValueError(EMPTY_MODEL_CONFIG_WARNING)

if values.get("report_steps") is not None:
ConfigWarning.warn(
"report_steps no longer has any effect and can be removed."
Expand All @@ -37,6 +42,9 @@ def remove_deprecated(cls, values):
@model_validator(mode="before")
@classmethod
def validate_realizations_weights_same_cardinaltiy(cls, values): # pylint: disable=E0213
if values is None:
raise ValueError(EMPTY_MODEL_CONFIG_WARNING)

weights = values.get("realizations_weights")
reals = values.get("realizations")

Expand Down

0 comments on commit 9e0cd23

Please sign in to comment.