Fix bug in app/data_flagging_app.py. This is a TODO/BUG [from Leïla] Correct error when flags are loaded in the app.

This commit is contained in:
2025-06-04 10:47:48 +02:00
parent c15aa4e828
commit da6884ef21
2 changed files with 14 additions and 5 deletions

View File

@ -1,5 +1,4 @@
# TODO # TODO
* [from Leïla] Data Flagging App. Correct error when flags are loaded in the app.
* [from Leïla] Before Step 5. The file should contain only data of the current year. * [from Leïla] Before Step 5. The file should contain only data of the current year.
* [from Leïla] Ebas converter. Change "9999.999" to "9999999.9999" in header * [from Leïla] Ebas converter. Change "9999.999" to "9999999.9999" in header
* [from Leïla] Ebas converter. Update Detection limit values in L2 header: take the ones (1h) from limits_of_detection.yaml * [from Leïla] Ebas converter. Update Detection limit values in L2 header: take the ones (1h) from limits_of_detection.yaml

View File

@ -722,13 +722,23 @@ def visualize_flag_on_figure(active_cell, value, figure, data):
def visualize_flags_on_table(n_clicks,value,memoryData): def visualize_flags_on_table(n_clicks,value,memoryData):
instFolder = memoryData.get('instfolder', '') instFolder = memoryData.get('instFolder', '')
filePath = memoryData.get('path_to_uploaded_file', '') filePath = memoryData.get('path_to_uploaded_file', None)
#flagfolderpath = os.path.join(os.path.splitext(memoryData['path_to_uploaded_file'])[0],f'{instfolder}_flags') #flagfolderpath = os.path.join(os.path.splitext(memoryData['path_to_uploaded_file'])[0],f'{instfolder}_flags')
if not filePath: if not filePath:
return dash.no_update return dash.no_update
# Modified version (appending "_flags" to the first folder)
flagFolder = instFolder.split('/')
flagFolder[0] = f"{flagFolder[0]}_flags" # Modify first folder
flagFolder = '/'.join(flagFolder)
# Remove .h5 ext from filepath and define expected flag folder
flagfolderpath = os.path.join(os.path.splitext(filePath)[0], flagFolder)
flagfolderpath = os.path.normpath(flagfolderpath)
@ -744,7 +754,7 @@ def visualize_flags_on_table(n_clicks,value,memoryData):
if n_clicks > 0 and vis_enabled: # and len(files) > 0: if n_clicks > 0 and vis_enabled: # and len(files) > 0:
tableData = data_flagging_utils.load_flags(filePath, instFolder) tableData = data_flagging_utils.load_flags(flagfolderpath)
if not tableData: if not tableData:
return dash.no_update return dash.no_update