From 00a85505c814f3ea6c3857dc03709a40725409be Mon Sep 17 00:00:00 2001 From: Florez Ospina Juan Felipe Date: Fri, 4 Apr 2025 16:53:41 +0200 Subject: [PATCH] Fix bug when infering name of flags file from dataset name --- pipelines/steps/visualize_datatable_vars.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pipelines/steps/visualize_datatable_vars.py b/pipelines/steps/visualize_datatable_vars.py index 4f3ad10..ce231e5 100644 --- a/pipelines/steps/visualize_datatable_vars.py +++ b/pipelines/steps/visualize_datatable_vars.py @@ -49,10 +49,15 @@ def visualize_table_variables(data_file_path, dataset_name, flags_dataset_name, flags_dataset_name_parts = flags_dataset_name.split(sep='/') flags_dataset_name_parts.remove('data_table') - # Build alternative path and attempt to read CSV - alternative_path = os.path.join(APPEND_DIR, '/'.join(flags_dataset_name_parts)) + # Remove existing extension and append .csv + base_path = os.path.join(APPEND_DIR, '/'.join(flags_dataset_name_parts)) + alternative_path = os.path.splitext(base_path)[0] + '_flags.csv' + + # Attempt to read CSV if not os.path.exists(alternative_path): - raise FileNotFoundError(f"File not found at {flags_dataset_name}. Ensure there are flags associated with {data_file_path}.") + raise FileNotFoundError( + f"File not found at {alternative_path}. Ensure there are flags associated with {data_file_path}." + ) flags_df = pd.read_csv(alternative_path) # Ensure the time variable exists in both datasets @@ -119,3 +124,5 @@ def visualize_table_variables(data_file_path, dataset_name, flags_dataset_name, + +