Skip to content

Commit

Permalink
Require at least one key for SummaryConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
eivindjahren committed Feb 16, 2024
1 parent 81b39d5 commit 46953f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ert/config/parsing/config_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ def summary_keyword() -> SchemaItem:
kw=ConfigKeys.SUMMARY,
required_set=False,
argc_max=None,
argc_min=1,
required_children=[ConfigKeys.ECLBASE],
multi_occurrence=True,
)
Expand Down
2 changes: 2 additions & 0 deletions src/ert/config/summary_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class SummaryConfig(ResponseConfig):
def __post_init__(self) -> None:
if isinstance(self.refcase, list):
self.refcase = {datetime.fromisoformat(val) for val in self.refcase}
if not self.keys:
raise ValueError("SummaryConfig must be given at least one key")

def read_from_file(self, run_path: str, iens: int) -> xr.Dataset:
filename = self.input_file.replace("<IENS>", str(iens))
Expand Down

0 comments on commit 46953f1

Please sign in to comment.