mirror of
https://gitea.psi.ch/APOG/acsmnode.git
synced 2025-07-03 06:30:47 +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 = flags_dataset_name.split(sep='/')
|
||||||
flags_dataset_name_parts.remove('data_table')
|
flags_dataset_name_parts.remove('data_table')
|
||||||
|
|
||||||
# Build alternative path and attempt to read CSV
|
# Remove existing extension and append .csv
|
||||||
alternative_path = os.path.join(APPEND_DIR, '/'.join(flags_dataset_name_parts))
|
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):
|
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)
|
flags_df = pd.read_csv(alternative_path)
|
||||||
|
|
||||||
# Ensure the time variable exists in both datasets
|
# 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