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

Flexible qc #62

Merged
merged 15 commits into from
Nov 15, 2023
Merged

Flexible qc #62

merged 15 commits into from
Nov 15, 2023

Conversation

Geet-George
Copy link
Owner

Solves #56

>
> the self.qc attribute is still not available in the class. this will be added later on.
> see #56 for a detailed explanation.
with the new filter_qc function and the self.qc attrs (upcoming, see #56),
these unused functions are removed. #56 also explains how the whole procedure provides
more flexibility for the user in terms of QC selection of checks and filtering flags.
@Geet-George Geet-George linked an issue Nov 15, 2023 that may be closed by this pull request
4 tasks
this qc attr as an empty object instance will now allow for
further setting of qc-related attributes such as with:
`object.__setattr__(self.qc,'qc_name',qc_flag_value)`

The function `qc_filter` already looks for attributes in `self.qc`
qc-related attrs are now provided as attrs to self.qc
which is an attr of self with the value of an empty object instance
and therefore can take attrs of its own

The qc checks now provide bool values to attrs of self.qc

an error in the `qc_filter` function is also fixed where previously
attr of self was removed instead of self.qc
add qc-attrs

this qc attr as an empty object instance will now allow for
further setting of qc-related attributes such as with:
`object.__setattr__(self.qc,'qc_name',qc_flag_value)`

qc-related attrs are now provided as attrs to self.qc
which is an attr of self with the value of an empty object instance
and therefore can take attrs of its own

The qc checks now provide bool values to attrs of self.qc

an error in the `qc_filter` function is also fixed where previously
attr of self was removed instead of self.qc
This commit introduces significant enhancements to the `qc_filter` function in the `sonde.py` file. The function now accepts `filter_flags` as an optional parameter, which can be a string, a list, or None. This change provides greater flexibility in specifying which QC-related attributes should be checked.

If `filter_flags` is None, all QC attributes will be checked. If it's a string, it's treated as a comma-separated list of individual flag values or prefixes of flag values. If it's a list, it's treated as a list of individual flag values or prefixes of flag values.

The function now also supports the 'all_except_<prefix>' syntax in `filter_flags`. This allows all flags to be filtered except those starting with '<prefix>'. If 'all_except_<prefix>' is provided, it should be the only value in `filter_flags`.

The function raises a ValueError if a flag in `filter_flags` does not exist as an attribute of the sonde object, or if 'all_except_<prefix>' is provided in `filter_flags` along with other values.

This commit thus makes it possible for the user to customize which QC flags will be used for filtering out before L2 and the remaining that will be propagated into L2 with their flag values.
The new_dict variable is now initialized inside the loop that iterates over the functions. This change ensures that for each function, a fresh new_dict is created. Previously, the new_dict was being populated across all functions, which could lead to incorrect results if a function modifies an existing key-value pair. Now, each function gets a clean slate (an empty dictionary), preventing potential key-value pair overwrites.
The config file will supply all as str, so such a function will be useful
For example, this commit also modifies the Sonde class to import helper
and use this new function to check for the value of the skip argument by first
converting the config provided value to bool.
add skip param to bypass QC checks
This name is more intuitive in meaning that the sonde will be filtered
if QC fails. The style is also now consistent with the naming of the function
`filter_no_launch_detect`.
This name is more intuitive in what the method does. It is also
consistent with the attribute naming that the method uses.
@Geet-George Geet-George marked this pull request as ready for review November 15, 2023 16:10
@Geet-George Geet-George merged commit ea0ed61 into main Nov 15, 2023
1 check passed
@Geet-George Geet-George deleted the flexible-qc branch November 15, 2023 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant