Skip to content

Commit

Permalink
Handle missing responses @ all_parameters_and_gen_data
Browse files Browse the repository at this point in the history
  • Loading branch information
yngve-sk committed Feb 28, 2025
1 parent 0ae5246 commit caba2dd
Show file tree
Hide file tree
Showing 10 changed files with 387 additions and 38 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 @@ -1139,8 +1139,11 @@ def all_parameters_and_gen_data(self) -> pl.DataFrame | None:
on="response_key", values="values"
)

params_and_responses = responses_wide.join(
params_wide, on="realization"
# If responses are missing for some realizations, this _left_ join will
# put null (polars) which maps to nan when doing .to_numpy() into the
# response columns for those realizations
params_and_responses = params_wide.join(
responses_wide, on="realization", how="left"
).with_columns(pl.lit(self.iteration).alias("batch"))

assert self.everest_realization_info is not None
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
[
{
"R1": null,
"R2": null,
"batch": 0,
"model_realization": 0,
"perturbation": -1,
"point.P1": 0.0,
"point.P2": 0.0,
"realization": 0
},
{
"R1": 10.0,
"R2": 10.0,
"batch": 0,
"model_realization": 5,
"perturbation": -1,
"point.P1": 1.0,
"point.P2": 1.0,
"realization": 1
},
{
"R1": 0.1,
"R2": 0.1,
"batch": 1,
"model_realization": 0,
"perturbation": 0,
"point.P1": 0.1,
"point.P2": 0.1,
"realization": 0
},
{
"R1": 10.1,
"R2": 10.1,
"batch": 1,
"model_realization": 0,
"perturbation": 1,
"point.P1": 1.1,
"point.P2": 1.1,
"realization": 1
},
{
"R1": 20.1,
"R2": 20.1,
"batch": 1,
"model_realization": 0,
"perturbation": 2,
"point.P1": 2.1,
"point.P2": 2.1,
"realization": 2
},
{
"R1": null,
"R2": null,
"batch": 1,
"model_realization": 5,
"perturbation": 0,
"point.P1": 3.1,
"point.P2": 3.1,
"realization": 3
},
{
"R1": 40.1,
"R2": 40.1,
"batch": 1,
"model_realization": 5,
"perturbation": 1,
"point.P1": 4.1,
"point.P2": 4.1,
"realization": 4
},
{
"R1": 50.1,
"R2": 50.1,
"batch": 1,
"model_realization": 5,
"perturbation": 2,
"point.P1": 5.1,
"point.P2": 5.1,
"realization": 5
},
{
"R1": null,
"R2": null,
"batch": 2,
"model_realization": 0,
"perturbation": -1,
"point.P1": 0.2,
"point.P2": 0.2,
"realization": 0
},
{
"R1": null,
"R2": null,
"batch": 2,
"model_realization": 5,
"perturbation": -1,
"point.P1": 1.2,
"point.P2": 1.2,
"realization": 1
},
{
"R1": 20.2,
"R2": 20.2,
"batch": 2,
"model_realization": 0,
"perturbation": 0,
"point.P1": 2.2,
"point.P2": 2.2,
"realization": 2
},
{
"R1": 30.2,
"R2": 30.2,
"batch": 2,
"model_realization": 0,
"perturbation": 1,
"point.P1": 3.2,
"point.P2": 3.2,
"realization": 3
},
{
"R1": null,
"R2": null,
"batch": 2,
"model_realization": 0,
"perturbation": 2,
"point.P1": 4.2,
"point.P2": 4.2,
"realization": 4
},
{
"R1": 50.2,
"R2": 50.2,
"batch": 2,
"model_realization": 5,
"perturbation": 0,
"point.P1": 5.2,
"point.P2": 5.2,
"realization": 5
},
{
"R1": 60.2,
"R2": 60.2,
"batch": 2,
"model_realization": 5,
"perturbation": 1,
"point.P1": 6.2,
"point.P2": 6.2,
"realization": 6
},
{
"R1": 70.2,
"R2": 70.2,
"batch": 2,
"model_realization": 5,
"perturbation": 2,
"point.P1": 7.2,
"point.P2": 7.2,
"realization": 7
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[
{
"R1": null,
"R2": null,
"batch": 0,
"model_realization": 0,
"perturbation": -1,
"point.P1": 0.0,
"point.P2": 0.0,
"realization": 0
},
{
"R1": 10.0,
"R2": 10.0,
"batch": 0,
"model_realization": 5,
"perturbation": -1,
"point.P1": 1.0,
"point.P2": 1.0,
"realization": 1
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[
{
"R1": 0.1,
"R2": 0.1,
"batch": 1,
"model_realization": 0,
"perturbation": 0,
"point.P1": 0.1,
"point.P2": 0.1,
"realization": 0
},
{
"R1": 10.1,
"R2": 10.1,
"batch": 1,
"model_realization": 0,
"perturbation": 1,
"point.P1": 1.1,
"point.P2": 1.1,
"realization": 1
},
{
"R1": 20.1,
"R2": 20.1,
"batch": 1,
"model_realization": 0,
"perturbation": 2,
"point.P1": 2.1,
"point.P2": 2.1,
"realization": 2
},
{
"R1": null,
"R2": null,
"batch": 1,
"model_realization": 5,
"perturbation": 0,
"point.P1": 3.1,
"point.P2": 3.1,
"realization": 3
},
{
"R1": 40.1,
"R2": 40.1,
"batch": 1,
"model_realization": 5,
"perturbation": 1,
"point.P1": 4.1,
"point.P2": 4.1,
"realization": 4
},
{
"R1": 50.1,
"R2": 50.1,
"batch": 1,
"model_realization": 5,
"perturbation": 2,
"point.P1": 5.1,
"point.P2": 5.1,
"realization": 5
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[
{
"R1": null,
"R2": null,
"batch": 2,
"model_realization": 0,
"perturbation": -1,
"point.P1": 0.2,
"point.P2": 0.2,
"realization": 0
},
{
"R1": null,
"R2": null,
"batch": 2,
"model_realization": 5,
"perturbation": -1,
"point.P1": 1.2,
"point.P2": 1.2,
"realization": 1
},
{
"R1": 20.2,
"R2": 20.2,
"batch": 2,
"model_realization": 0,
"perturbation": 0,
"point.P1": 2.2,
"point.P2": 2.2,
"realization": 2
},
{
"R1": 30.2,
"R2": 30.2,
"batch": 2,
"model_realization": 0,
"perturbation": 1,
"point.P1": 3.2,
"point.P2": 3.2,
"realization": 3
},
{
"R1": null,
"R2": null,
"batch": 2,
"model_realization": 0,
"perturbation": 2,
"point.P1": 4.2,
"point.P2": 4.2,
"realization": 4
},
{
"R1": 50.2,
"R2": 50.2,
"batch": 2,
"model_realization": 5,
"perturbation": 0,
"point.P1": 5.2,
"point.P2": 5.2,
"realization": 5
},
{
"R1": 60.2,
"R2": 60.2,
"batch": 2,
"model_realization": 5,
"perturbation": 1,
"point.P1": 6.2,
"point.P2": 6.2,
"realization": 6
},
{
"R1": 70.2,
"R2": 70.2,
"batch": 2,
"model_realization": 5,
"perturbation": 2,
"point.P1": 7.2,
"point.P2": 7.2,
"realization": 7
}
]
Loading

0 comments on commit caba2dd

Please sign in to comment.