mirror of
https://gitea.psi.ch/APOG/acsmnode.git
synced 2025-06-27 03:51:13 +02:00
Fix bug when infering name of flags file from dataset name
This commit is contained in:
@ -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,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user