Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindeide authored and eivindjahren committed Aug 30, 2023
1 parent fe1db52 commit 6aea45f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/ert/config/ensemble_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ def make_field(field_list: List[str]) -> Field:
time_map = []
if refcase_file_path is not None:
refcase = cls._load_refcase(refcase_file_path)
time_map = [
time_map = set(
datetime(date.year, date.month, date.day)
for date in refcase.report_dates
]
)
optional_keys = []
summary_keys = [item for sublist in summary_list for item in sublist]
for key in summary_keys:
Expand Down
14 changes: 6 additions & 8 deletions src/ert/config/summary_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from dataclasses import dataclass
from datetime import datetime
from fnmatch import fnmatch
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Set

import numpy as np
import xarray as xr
Expand All @@ -24,7 +24,7 @@
class SummaryConfig(ResponseConfig):
input_file: str
keys: List[str]
refcase: Optional[List[datetime]] = None
refcase: Optional[Set[datetime]] = None

def read_from_file(self, run_path: str, iens: int) -> xr.Dataset:
filename = self.input_file.replace("<IENS>", str(iens))
Expand All @@ -45,16 +45,14 @@ def read_from_file(self, run_path: str, iens: int) -> xr.Dataset:
c_time = summary.alloc_time_vector(True)
time_map = [t.datetime() for t in c_time]
if self.refcase:
missing = []
for reference_time in self.refcase:
if reference_time not in time_map:
missing.append(reference_time)
missing = self.refcase.difference(time_map)
if missing:
first, last = min(missing), max(missing)
logger.warning(
f"Realization: {iens}, load warning: {len(missing)} "
f"inconsistencies in time map, first: Time mismatch for response "
f"time: {missing[0]}, last: Time mismatch for response time: "
f"{missing[-1]} from: {run_path}/{filename}.UNSMRY"
f"time: {first}, last: Time mismatch for response time: "
f"{last} from: {run_path}/{filename}.UNSMRY"
)

user_summary_keys = set(self.keys)
Expand Down

0 comments on commit 6aea45f

Please sign in to comment.