Skip to content

Commit

Permalink
Keep missing responses/observations explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
Yngve S. Kristiansen committed Mar 20, 2024
1 parent 623b1ba commit 0e23b56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/ert/storage/local_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,11 @@ def set_key_index(df, index: List[str]):
)

filtered_response = obs_ds.merge(responses_ds, join="left")
df = filtered_response.to_dataframe().reset_index().dropna()
df = (
filtered_response.to_dataframe()
.reset_index()
.dropna(subset="observations")
)

index = ObservationsIndices[response_type]
set_key_index(df, index)
Expand Down Expand Up @@ -702,7 +706,6 @@ def set_key_index(df, index: List[str]):
and not drop_observations_without_response
and any(not x.empty for x in observations_without_responses)
):

for df in observations_without_responses:
df[long_dfs[0].columns[2:]] = np.nan
df.drop(columns=["name"], inplace=True)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/scenarios/test_summary_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,4 @@ def test_that_mismatched_responses_gives_nan_measured_data(ert_config, prior_ens
assert fopr_2.loc["STD"].iloc[1] == 0.05
assert pd.isna(fopr_2.loc[0].iloc[1])
assert pd.isna(fopr_2.loc[1].iloc[1])
assert pd.isna(fopr_1.loc[2].iloc[1])
assert pd.isna(fopr_2.loc[2].iloc[1])

0 comments on commit 0e23b56

Please sign in to comment.