Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ioos-qc library in glider_qc.py #289

Closed
wants to merge 22 commits into from

Conversation

leilabbb
Copy link
Contributor

@leilabbb leilabbb commented Oct 3, 2023

Changes introduced to the script:
With all files having an initial list of qartods variables the following functions are no longer needed and have been commented out:
find_qc_flags
needs_qc
create_qc_variables
apply_primary_qc

The following function were modified or added to adapt the ioos-qc library methodology:
-- Modified:
apply_qc
run_qc
check_needs_qc
-- Added
update_config

The updated glider_qc.py does the following:

  • Read a netcdf file and lists the legacy variables and the associated qartod variables
  • Use the quality thresholds in the /data/qc_config.yml to calculate the ioos-qc qartod tests results
  • Tested variables with the following list of qc tests: ['gross_range_test',
    'spike_test',
    'rate_of_change_test']
  • Aggregate the qc test results to use the worst flag (4 = FAIL) if it does exist in any of the tests. The order of the flag selection is: 9= MISSING , 2=NOT-EVAL, 1=PASS, 3=SUSPECT, 4=FAIL.

More functionality to verify:

  • check the flat line test: it has a "divide by zero" error produced by taking the diff of the time array.
  • check the spike_test it seems it is not working as expected.
  • check the xattr of the file to verify if the file has been quality controlled.

added an extension in the requirement file to pull in the ioos-qc library package
Fixed the flag name attribute to match ioos-qc definitions
Fixed the manual link
Added the min and max values for a flag
Modified the script to create qartod variables and add the qartod test results to each qartod variable.
- Changed the required variables to a list of qartod variables.
- Made changes to  few functions to work accordingly.
fixed spelling detected by the code checks
rectified the omitted quotes in line 611
added 'nc_path'  to the run_qc function
commented out an old version of  the get_unmasked function
fixed syntax errors
added qartod_status attribute
fixed log.info() and log.exception() syntax errors
it did not like the addition log.exception() added to the "except OSError:" when checking os.getxattr() in the previous commit.
extended qartod variables' attributes to include more verbose explanation
added more to log.info for debugging purposes
@benjwadams
Copy link
Contributor

Could you please squash some of these commits down thematically?

commented out the ioos_qartod git repo that has been deprecated
@benjwadams
Copy link
Contributor

pre-commit fix

@benjwadams
Copy link
Contributor

pre-commit.ci autofix

@benjwadams
Copy link
Contributor

We should be able to close this now that #320 and #321 are merged, correct?

@benjwadams benjwadams closed this Mar 11, 2024
@benjwadams benjwadams deleted the leilabbb-implement-ioos-qc-flags branch March 11, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants