fluxnetCDF.py
def filter_output(df):
    """Filters output variables to be written based on flags in output_variables.csv."""
    variable_groups = pd.read_csv('doc/variable_groups.csv', sep=';')
    output_variables = pd.read_csv('output_variables.csv', sep='\t')

    # filter all variables from groups flagged with 1
    output_groups = output_variables.loc[output_variables['FLAG'] == 1]['GROUP'].values
    output_variables = variable_groups[variable_groups['Group'].isin(output_groups)]['Variable']

    # Some variables are numbered like TA_F_MDS_1, but listed as TA_F_MDS_#. REGEX are used to filter them out
    numbered_variables = []
    for numbered_variable in list(output_variables[output_variables.str.contains('#')]):
        numbered_variables.append(list(filter(re.compile(numbered_variable.replace('#', r'\d')).match, df.columns)))
    numbered_variables = [item for subitem in numbered_variables for item in subitem]
    output_variables = [*output_variables, *numbered_variables]

    # filter out q
    if 'QUALITY FLAGS' not in output_groups:
        output_variables = [v for v in output_variables if 'QC' not in v]

    df = df.drop(columns=df.columns.difference(list(output_variables)), axis=1, errors='ignore')
    return df
Filters output variables to be written based on flags in output_variables.csv.
Filters output variables to be written based on flags in output_variables.csv.
Filters output variables to be written based on flags in output_variables . csv .
def filter_output(df):
    variable_groups = pd.read_csv('doc/variable_groups.csv', sep=';')
    output_variables = pd.read_csv('output_variables.csv', sep='\t')
    output_groups = output_variables.loc[output_variables['FLAG'] == 1]['GROUP'].values
    output_variables = variable_groups[variable_groups['Group'].isin(output_groups)]['Variable']
    numbered_variables = []
    for numbered_variable in list(output_variables[output_variables.str.contains('#')]):
        numbered_variables.append(list(filter(re.compile(numbered_variable.replace('#', r'\d')).match, df.columns)))
    numbered_variables = [item for subitem in numbered_variables for item in subitem]
    output_variables = [*output_variables, *numbered_variables]
    if 'QUALITY FLAGS' not in output_groups:
        output_variables = [v for v in output_variables if 'QC' not in v]
    df = df.drop(columns=df.columns.difference(list(output_variables)), axis=1, errors='ignore')
    return df
def filter_output ( df ) : variable_groups = pd . read_csv ( 'doc/variable_groups.csv' , sep = ';' ) output_variables = pd . read_csv ( 'output_variables.csv' , sep = '\t' ) output_groups = output_variables . loc [ output_variables [ 'FLAG' ] == 1 ] [ 'GROUP' ] . values output_variables = variable_groups [ variable_groups [ 'Group' ] . isin ( output_groups ) ] [ 'Variable' ] numbered_variables = [ ] for numbered_variable in list ( output_variables [ output_variables . str . contains ( '#' ) ] ) : numbered_variables . append ( list ( filter ( re . compile ( numbered_variable . replace ( '#' , r'\d' ) ) . match , df . columns ) ) ) numbered_variables = [ item for subitem in numbered_variables for item in subitem ] output_variables = [ * output_variables , * numbered_variables ] if 'QUALITY FLAGS' not in output_groups : output_variables = [ v for v in output_variables if 'QC' not in v ] df = df . drop ( columns = df . columns . difference ( list ( output_variables ) ) , axis = 1 , errors = 'ignore' ) return df
Filters output variables to be written based on flags in output_variables.csv.
Filters output variables to be written based on flags in output_variables . csv .
"""Filters output variables to be written based on flags in output_variables.csv.""" # filter all variables from groups flagged with 1 # Some variables are numbered like TA_F_MDS_1, but listed as TA_F_MDS_#. REGEX are used to filter them out # filter out q
df