Skip to content

Commit b762293

Browse files
committed
Sort time data explicitly before asof join
1 parent be25b51 commit b762293

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/ert/storage/local_ensemble.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -986,13 +986,17 @@ def get_observations_and_responses(
986986
)
987987
)
988988
elif "time" in pivoted:
989-
joined = observations_for_type.join_asof(
990-
pivoted,
991-
by=[
992-
"response_key",
993-
*[k for k in response_cls.primary_key if k != "time"],
994-
],
989+
by_cols = [
990+
"response_key",
991+
*[k for k in response_cls.primary_key if k != "time"],
992+
]
993+
joined = observations_for_type.sort(
994+
by=[*by_cols, "time"]
995+
).join_asof(
996+
pivoted.sort(by=[*by_cols, "time"]),
997+
by=by_cols,
995998
on="time",
999+
check_sortedness=False, # Ref: https://github.com/pola-rs/polars/issues/21693
9961000
strategy="nearest",
9971001
tolerance="1s",
9981002
)

0 commit comments

Comments
 (0)