act.utils.calculate_dqr_times#
- act.utils.calculate_dqr_times(ds, variable=None, txt_path=None, threshold=None, qc_bit=None, return_missing=True)[source]#
Function to retrieve start and end times of missing or bad data. Function will retrieve start and end time strings in a format that the DQR submission tool can read, print them to the console, and save to a .txt file if desired.
- Parameters:
ds (xarray.Dataset) – Xarray dataset as read by ACT where data are stored.
variable (str or list of str) – Data variable(s) in the dataset to check. Can check multiple variables.
txt_path (str) – Full path to directory in which to save .txt files with start and end times. If directory doesn’t exist the program will create it. If set to None then no .txt files will be created. Default is None.
threshold (int) – Threshold of number of data points to trigger start and end time calculations. Value is interpreted differently depending on the resolution of the data in the specified files. For example, if data is 1-minute data, a threshold of 30 would mean flagged data more than 30 minutes apart would show up as two separate time ranges; if data is 30- minute data, a threshold of 2 would mean flagged data more than 60 mins apart would show up as two separate time ranges.
qc_bit (int) – Bit number to choose if finding times for bad data. If set then will override searching for missing data. Default is None.
return_missing (bool) – Specifies whether or not to return times of data flagged as missing. If set to False, will return times of bad data. Default is True.
- Returns:
time_strings (list) – List of tuples with the first element as the start time and the second element as the end time.