Skip to content
This repository has been archived by the owner on Jul 19, 2021. It is now read-only.

Commit

Permalink
remove fs dependency for summary observation collector
Browse files Browse the repository at this point in the history
  • Loading branch information
ManInFez committed Feb 24, 2021
1 parent 77c3e45 commit b5ec732
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions python/res/enkf/export/summary_observation_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,40 +30,32 @@ def loadObservationData(ert, case_name, keys=None):
@type keys: list of str
@rtype: DataFrame
"""
fs = ert.getEnkfFsManager().getFileSystem(case_name)

time_map = fs.getTimeMap()
dates = [time_map[index].datetime() for index in range(1, len(time_map))]

observations = ert.getObservations()
history_length = ert.getHistoryLength()
dates = [
observations.getObservationTime(index).datetime()
for index in range(1, history_length)
]
summary_keys = SummaryObservationCollector.getAllObservationKeys(ert)
if keys is not None:
summary_keys = [
key for key in keys if key in summary_keys
] # ignore keys that doesn't exist

columns = summary_keys
std_columns = ["STD_%s" % key for key in summary_keys]

df = DataFrame(index=dates, columns=columns + std_columns)

for key in summary_keys:
observation_keys = ert.ensembleConfig().getNode(key).getObservationKeys()

for obs_key in observation_keys:
observations = ert.getObservations()
observation_data = observations[obs_key]
history_length = ert.getHistoryLength()

for index in range(0, history_length):
if observation_data.isActive(index):
obs_time = observations.getObservationTime(index).datetime()
node = observation_data.getNode(index)
value = node.getValue()
std = node.getStandardDeviation()

df[key][obs_time] = value
df["STD_%s" % key][obs_time] = std

return df

@classmethod
Expand Down

0 comments on commit b5ec732

Please sign in to comment.