act.qc.QCFilter.check_for_ancillary_qc#

QCFilter.check_for_ancillary_qc(var_name, add_if_missing=True, cleanup=False, flag_type=False)[source]#

Method to check if a quality control variable exist in the dataset and return the quality control varible name. Will call create_qc_variable() to make variable if does not exist and update_ancillary_variable() to ensure linkage between data and quality control variable. Can also be used just to get the corresponding quality control variable name with adding if it is missing.

Parameters:
  • var_name (str) – Data variable name.

  • add_if_missing (boolean) – Add quality control variable if missing from teh dataset. Will raise and exception if the var_name does not exist in Dataset. Set to False to not raise exception.

  • cleanup (boolean) – Option to run qc.clean.cleanup() method on the dataset to ensure the dataset was updated from ARM QC to the correct standardized QC.

  • flag_type (boolean) – Indicating the QC variable uses flag_values instead of flag_masks.

Returns:

qc_var_name (str or None) – Name of existing or new quality control variable. Returns None if no existing quality control variable is found and add_if_missing is set to False.

Examples

from act.tests import EXAMPLE_METE40
from act.io.arm import read_arm_netcdf
ds = read_arm_netcdf(EXAMPLE_METE40, cleanup_qc=True)
qc_var_name = ds.qcfilter.check_for_ancillary_qc('atmos_pressure')
print(f'qc_var_name: {qc_var_name}')
qc_var_name = ds.qcfilter.check_for_ancillary_qc('the_greatest_variable_ever',
    add_if_missing=False)
print(f'qc_var_name: {qc_var_name}')