-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fix OOL Dependency Handling, RH Clipping, and Bufr Export Rounding #307
Conversation
* Added unit test for processing wind speed
We only of 1 digits precision measurments from out instantaneous values. This violates the bufr schema which expects 2 digits precision.
OOL contains dependent variables (children) * Added unit test functions for clip_values * Add a helper class, DependencyGraph, for modelling the dependency relations to find the children closure and handle circular dependencies. * Updated clip_values to set children variables to nan whenever a parent is nan. * Fixed a bug in clipValues introduced in commit d1a6ac8, where child variables were not set to nan due to an erroneous change in variable names. Fixed variables.csv * Removed incorrect OOL relations from variables.csv. wspd_x_u, wspd_y_u... had wdir and wspd as children. The relation is the opposite. * Removed double quotes around ool * Removed comma between ool entries in wspeed
* The rh corrected clipping were asigning 0 to inpu nan * Added unit test specifically for rh corr
945829b
to
b662e0a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rehabilitating the OOL dependencies is a correct thing to do and it looks great!
Since it is equivalent to reactivating a lot of filters at once, every variable at every site should be investigated before and after this update to make sure good data is not being removed due to an wrong dependency or limit value.
Cases where uncorrected values are used in the corrected variables when the correction si not possible, should be identified.
For instance, I am suspecting that z_pt_cor contains the same values as z_pt when the correction is not possible, same thing for dsr_cor and usr_cor.
In those cases, enforcing the OOL dependencies will switch those _cor
variables from "corrected values when possible" to "only corrected values", and potentially impact downstream calculations that are OK with "corrected values when possible".
Last, the "lo" "hi" and "OOL" names in the columns of variable.csv
do not make sense. Might be the opportunity to change the to lower_limit, upper_limit, dependent_variables
or alike.
I don't want to postpone any longer making the updated pypromice operational, so it would be totally fine if the dependency handling was left for a future PR and only the necessary updates went to develop
and then main
.
And before it goes operational, it would be great to add the compression of the netcdf files. |
The following table shows the current dependency closures between the variables
|
@BaptisteVandecrux and I just talked about removing all the OOL relations and reintroduce them as we investigate the consequences. The reason why I initially looked into this was because the was an inconsistency in the wind direction and wind speed in the BUFR files. |
The logic for handling `rh` values has been simplified to align with the general clipping rules. This change removes the exception cases previously applied to `rh`, ensuring consistent value clipping across all variables.
This PR introduces multiple fixes and improvements related to OOL dependency handling, relative humidity (RH) clipping, and rounding in Bufr export. Additionally, it includes code formatting and the addition of helper functions for wind speed calculations.
Changes:
OOL Dependency Handling:
RH Corrected Clipping:
BUFR Export Precision:
Helper Function for Wind Speed:
Code Formatting:
Unit Tests:
These changes improve the reliability of OOL handling, ensure correct data export, and enforce better code structure through unit tests and formatting.