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([ #dbc.Row([
dcc.Dropdown( dcc.Dropdown(
id='flag-options', 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 #width=12

View File

@ -32,18 +32,24 @@ def save_file(name, content):
def filter_flags_by_label(flags_dict, label): def filter_flags_by_label(flags_dict, label):
""" """
Filters the flags dictionary by the specified label. Filters the flags dictionary by the specified label.
If label is 'all', returns all flags without filtering.
Parameters: Parameters:
----------- -----------
flags_dict (dict): The dictionary containing flags. 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: 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} return [
for code, value in flags_dict.items() if value['validity'] == label] {'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): def create_loaded_file_figure(file_path, instFolder, dataset_name, datetime_var, datetime_var_format, variables):

View File

@ -1,7 +1,4 @@
flags: flags:
0:
validity: "V"
description: "Valid measurement"
100: 100:
validity: "V" validity: "V"
description: "Checked by data originator. Valid measurement, overrides any invalid flags" description: "Checked by data originator. Valid measurement, overrides any invalid flags"
@ -14,27 +11,30 @@ flags:
456: 456:
validity: "I" validity: "I"
description: "Invalidated by data originator" description: "Invalidated by data originator"
460:
validity: "I"
description: "Contamination suspected"
559: 559:
validity: "V" validity: "V"
description: "Unspecified contamination or local influence, but considered valid" description: "Unspecified contamination or local influence, but considered valid"
599:
validity: "I"
description: "Unspecified contamination or local influence"
652: 652:
validity: "V" validity: "V"
description: "Construction/activity nearby" description: "Construction/activity nearby"
659:
validity: "I"
description: "Unspecified instrument/sampling anomaly"
660: 660:
validity: "V" validity: "V"
description: "Unspecified instrument/sampling anomaly" 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: 999:
validity: "I" validity: "I"
description: "Missing measurement, unspecified reason" description: "Missing measurement, unspecified reason"
0:
validity: "V"
description: "Valid measurement"
# Define flag rankings with flag 0 as the absolute lowest # 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} 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}