From e39f3dcbc2048e97365de2c7f217ca837c2c5393 Mon Sep 17 00:00:00 2001 From: Alif Be Date: Thu, 12 Oct 2023 12:36:47 +0200 Subject: [PATCH] Ensure backward compatibility gendata_rft pre 2021 --- src/subscript/merge_rft_ertobs/merge_rft_ertobs.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/subscript/merge_rft_ertobs/merge_rft_ertobs.py b/src/subscript/merge_rft_ertobs/merge_rft_ertobs.py index 078d07aa2..f391d8cc8 100644 --- a/src/subscript/merge_rft_ertobs/merge_rft_ertobs.py +++ b/src/subscript/merge_rft_ertobs/merge_rft_ertobs.py @@ -223,8 +223,11 @@ def merge_rft_ertobs(gendatacsv: str, obsdir: str) -> pd.DataFrame: # For each simulated well, look up logger.info("Parsed %s observations from files in %s", str(len(obs_df)), obsdir) - - return pd.merge(sim_df, obs_df, how="left", on=["well", "order", "report_step"]) + if "report_step" in sim_df.columns: + return pd.merge(sim_df, obs_df, how="left", on=["well", "order", "report_step"]) + else: + # Ensure backward compatibility where gendata_rft + return pd.merge(sim_df, obs_df, how="left", on=["well", "order"]) def main() -> None: