Enable all flaggs for use in flagging app and display them in order according to their ranking (see app/flags/ebas_dict.yaml)

This commit is contained in:
2025-05-19 17:10:16 +02:00
parent ccd4740dba
commit e4d87080bc
3 changed files with 23 additions and 17 deletions

View File

@ -33,7 +33,7 @@ flagging_dashboard = dbc.Row([
#dbc.Row([
dcc.Dropdown(
id='flag-options',
options= data_flagging_utils.filter_flags_by_label(flags_dict,'I'), # displays only flags to invalidate
options= data_flagging_utils.filter_flags_by_label(flags_dict,'all'), # displays only flags to invalidate
),
#],
#width=12

View File

@ -32,18 +32,24 @@ def save_file(name, content):
def filter_flags_by_label(flags_dict, label):
"""
Filters the flags dictionary by the specified label.
If label is 'all', returns all flags without filtering.
Parameters:
-----------
flags_dict (dict): The dictionary containing flags.
label (str): The label to filter by ('I' or 'V').
label (str): The label to filter by ('I', 'V', or 'all').
Returns:
--------
list: A list of dictionaries with 'label' and 'value' for the specified label.
list: A list of dictionaries with 'label' and 'value' for the specified label,
or all flags if label is 'all'.
"""
return [{'label': value['description'], 'value': code}
for code, value in flags_dict.items() if value['validity'] == label]
return [
{'label': value['description'], 'value': code}
for code, value in flags_dict.items()
if label == 'all' or value['validity'] == label
]
def create_loaded_file_figure(file_path, instFolder, dataset_name, datetime_var, datetime_var_format, variables):

View File

@ -1,7 +1,4 @@
flags:
0:
validity: "V"
description: "Valid measurement"
100:
validity: "V"
description: "Checked by data originator. Valid measurement, overrides any invalid flags"
@ -14,27 +11,30 @@ flags:
456:
validity: "I"
description: "Invalidated by data originator"
460:
validity: "I"
description: "Contamination suspected"
559:
validity: "V"
description: "Unspecified contamination or local influence, but considered valid"
599:
validity: "I"
description: "Unspecified contamination or local influence"
652:
validity: "V"
description: "Construction/activity nearby"
659:
validity: "I"
description: "Unspecified instrument/sampling anomaly"
660:
validity: "V"
description: "Unspecified instrument/sampling anomaly"
460:
validity: "I"
description: "Contamination suspected"
599:
validity: "I"
description: "Unspecified contamination or local influence"
659:
validity: "I"
description: "Unspecified instrument/sampling anomaly"
999:
validity: "I"
description: "Missing measurement, unspecified reason"
0:
validity: "V"
description: "Valid measurement"
# Define flag rankings with flag 0 as the absolute lowest
flag_ranking : {100: 100, 110: 80, 111: 75, 456: 60, 559: 50, 652: 40, 660: 30, 460: 28, 599: 26, 659: 24, 999: 20, 0: 10}