Skip to content

Commit

Permalink
Group observations by response (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yngve S. Kristiansen committed Mar 5, 2024
1 parent e80ad0d commit 0458397
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions src/ert/analysis/_es_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,21 +295,35 @@ def _get_obs_and_measure_data(

df = filtered_response.to_dataframe().reset_index()

Check failure on line 296 in src/ert/analysis/_es_update.py

View workflow job for this annotation

GitHub Actions / check-style (3.12)

Local variable `df` is assigned to but never used

observation_keys.append(df["name"].to_list())
observation_values.append(df["observations"].to_list())
observation_errors.append(df["std"].to_list())
observation_keys.extend(
observation.to_dataframe()
.reset_index()["name"]
.to_numpy()
.reshape((len(filtered_response.name), -1))
.tolist()
)
observation_values.extend(
observation["observations"]
.to_dataframe()
.to_numpy()
.reshape((1, -1))
.tolist()
)
observation_errors.extend(
observation["std"].to_dataframe().to_numpy().reshape((1, -1)).tolist()
)

measured_data.append(
measured_data.extend(
filtered_response["values"]
.transpose(..., "realization")
.values.reshape((-1, len(filtered_response.realization)))
.values.reshape(
(len(filtered_response.name), -1, len(filtered_response.realization))
)
)
source_fs.load_responses.cache_clear()

# Measured_data, an array of 3 dimensions
# Outer dimension: One array per observation
# Mid dimension is ??? Sometimes length 1, sometimes nreals?
# Inner dimension: value is "values", index is realization
# Measured_data, an array of nd arrays with shape (1, nreals)
# Each inner array has 1 dimension containing obs key, and nreals "values"
return (
np.concatenate(measured_data, axis=0),
np.concatenate(observation_values),
Expand Down

0 comments on commit 0458397

Please sign in to comment.