Skip to content

Commit

Permalink
Warn when min_realizations > num_realizations
Browse files Browse the repository at this point in the history
  • Loading branch information
eivindjahren committed Sep 21, 2023
1 parent 7b6b10b commit dcf690d
Show file tree
Hide file tree
Showing 2 changed files with 212 additions and 166 deletions.
14 changes: 13 additions & 1 deletion src/ert/config/analysis_config.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import logging
import warnings
from math import ceil
from os.path import realpath
from typing import Dict, List, Optional, Tuple, no_type_check

from .analysis_iter_config import AnalysisIterConfig
from .analysis_module import AnalysisMode, AnalysisModule
from .parsing import ConfigDict, ConfigKeys, ConfigValidationError
from .parsing import ConfigDict, ConfigKeys, ConfigValidationError, ConfigWarning

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -75,6 +76,17 @@ def from_dict(cls, config_dict: ConfigDict) -> "AnalysisConfig":
# Make sure min_realization is not greater than num_realization
if min_realization == 0:
min_realization = num_realization

if min_realization > num_realization:
warnings.warn(
ConfigWarning.with_context(
"MIN_REALIZATIONS set to more than NUM_REALIZATIONS, "
"will set required to successful realizations to 100%. "
"For more flexibility, you can use e.g. 'MIN_REALIZATIONS 80%'.",
min_realization_str,
),
stacklevel=1,
)
min_realization = min(min_realization, num_realization)

config = cls(
Expand Down
Loading

0 comments on commit dcf690d

Please sign in to comment.