-
Notifications
You must be signed in to change notification settings - Fork 37
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
Unit conversion warning #795
Conversation
verbose : boolean | ||
Option to print statement when an attempted conversion fails. Set to False | ||
as default because many units strings are not udunits complient and when | ||
trying to convert all varialbes of a type of units (eg temperature) the code |
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.
complient to compliant and varialbes to variables
tests/utils/test_data_utils.py
Outdated
@@ -93,10 +95,13 @@ def test_convert_units(): | |||
data = act.utils.data_utils.convert_units(r_data, 'K', 'C') | |||
assert np.ceil(data[0]) == 12 | |||
|
|||
try: | |||
# try: | |||
# ds.utils.change_units() |
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.
Can we remove the commented out code?
@kenkehoe Thanks for the PR! I added a few comments |
@zssherman I removed the old code and submitted a job to run. I assume you can make the failing part of this process more better? I don't think it's something on my end. |
@kenkehoe Thanks for the changes! Yeah it was a stalled test. Should be rerunning now |
This adds keywords to the convert_units method to notify user when the conversion fail. Because of how the method can loop through all the variables in the Dataset we don't want to print or raise exceptions when a conversion fails. This adds options the user can implement. I tried to use warnings but they didn't work so it's a print statement.