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

add QC workflow #46

Merged
merged 9 commits into from
Nov 9, 2023
Merged

add QC workflow #46

merged 9 commits into from
Nov 9, 2023

Conversation

Geet-George
Copy link
Owner

Should close #45

Adding this function directly to the Sonde class means that:

1. we can remove the separate qc module as it is no longer needed (all qc checks will be run in the sonde class itself)

2. the fullness without the weights is not going to be needed, so that doesn't need to be a qc function in the Sonde class

3. the weighted_fullness function is now changed so that the variable argument has a default value. This default value is now
a dictionary where the keys are variable names expected in the dataset and the values are the corresponding sampling frequencies.
Therefore, the sampling_frequency argument is no longer needed.

4. This also means that the separate RD41 config file can be removed.
Reading through it will no longer be used. Instead if the user wants to provide different variables/sampling frequencies, they can
do so using the main config file, which through the main() function in halodrops.__init__ will be replaced as a non-default value
for this function.

5. Similarly, for the timestamp_frequency, the default value is now given as 4. The user can change it if they want.
The value of 4 is no longer fixed in the function.

6. Docstrings have been changed to reflect the changes in the function
This commit introduces a new Quality Control (QC) check method `qc_check_profile_fullness` in the `Sonde` class. This method checks if the profile coverage of a `Sonde` instance is above a specified threshold.

Key changes:

1. The `qc_check_profile_fullness` method takes an optional `qc_threshold` parameter, which defaults to 0.8. This parameter specifies the threshold for profile coverage.

2. The method checks if the `Sonde` instance has an attribute `profile_coverage`. If it does, the method checks if `profile_coverage` is greater than `qc_threshold`. If it is, the method returns `True`; otherwise, it returns `False`.

3. If the `Sonde` instance does not have a `profile_coverage` attribute, the method raises a `ValueError` with a message instructing the user to run the `weighted_fullness` method first.

4. The `apply_qc_checks` method in the `Sonde` class has been updated to include the new `qc_check_profile_fullness` method in the `qc_functions` dictionary.

5. A reason for the `qc_functions` dictionary to only say "profile fullness" instead of the whole function name is that I am thinking of having all the functions for "qc_checks" start with "qc_check_". This would make the dictionary keys unnecessarily long and also make it clear from the function names that they are QC checks.
This commit introduces two new methods in the `Sonde` class: `near_surface_coverage` and `qc_check_near_surface_coverage`.

Key changes:

1. The `near_surface_coverage` method calculates the fraction of non-NaN values in specified variables near the surface. It takes a list of variables, altitude bounds, and the name of the altitude dimension as parameters. It raises a `ValueError` if the `aspen_ds` attribute does not exist.

2. The `qc_check_near_surface_coverage` method checks if the near surface coverage is above a specified threshold. It returns `True` if the coverage is above the threshold and `False` otherwise. It raises a `ValueError` if the `near_surface_coverage` attribute does not exist.

3. The `apply_qc_checks` method in the `Sonde` class now calls the `qc_check_near_surface_coverage` method.
The qc_check function now checks if all provided variables in
the `weighted_fullness` function satisfy the qc_threshold. If any don't,
the function returns False, else True.
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