act.qc.add_dqr_to_qc#
- act.qc.add_dqr_to_qc(ds, variable=None, assessment='incorrect,suspect', exclude=None, include=None, normalize_assessment=True, cleanup_qc=True, dqr_link=False, skip_location_vars=False, create_missing_qc_variables=True)[source]#
Function to query the ARM DQR web service for reports and add as a new quality control test to ancillary quality control variable. If no anicllary quality control variable exist a new one will be created and lined to the data variable through ancillary_variables attribure.
See online documentation from ARM Data Quality Office on the use of the DQR web service.
https://code.arm.gov/docs/dqrws-examples/wikis/home
Information about the DQR web-service avaible at https://adc.arm.gov/dqrws/
- Parameters:
ds (xarray.Dataset) – Xarray dataset
variable (string, or list of str, or None) – Variables to check DQR web service. If set to None will attempt to update all variables.
assessment (string) – assessment type to get DQRs. Current options include ‘missing’, ‘suspect’, ‘incorrect’ or any combination separated by a comma.
exclude (list of strings) – DQR IDs to exclude from adding into QC
include (list of strings) – List of DQR IDs to include in flagging of data. Any other DQR IDs will be ignored.
normalize_assessment (boolean) – The DQR assessment term is different than the embedded QC term. Embedded QC uses “Bad” and “Indeterminate” while DQRs use “Incorrect” and “Suspect”. Setting this will ensure the same terms are used for both.
cleanup_qc (boolean) – Call clean.cleanup() method to convert to standardized ancillary quality control variables. Has a little bit of overhead so if the Dataset has already been cleaned up, no need to run.
dqr_link (boolean) – Prints out a link for each DQR to read the full DQR. Defaults to False
skip_location_vars (boolean) – Does not apply DQRs to location variables. This can be useful in the event the submitter has erroneously selected all variables.
create_missing_qc_variables (boolean) – If a quality control variable for the data variable does not exist, create the quality control varible and apply DQR.
- Returns:
ds (xarray.Dataset) – Xarray dataset containing new or updated quality control variables
Examples
from act.qc.arm import add_dqr_to_qc ds = add_dqr_to_qc(ds, variable=['temp_mean', 'atmos_pressure'])