-
Notifications
You must be signed in to change notification settings - Fork 408
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
Units: convert '%' to 'percent' for within the xarray MetPy accessor #1057
Conversation
95207bd
to
67156e9
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.
Nice easy change. Just a few lint issues that came up, the suggestions "should" work. Be sure to flake8 the test_xarray.py file to be sure.
metpy/tests/test_xarray.py
Outdated
@@ -84,6 +84,13 @@ def test_units(test_var): | |||
assert test_var.metpy.units == units('kelvin') | |||
|
|||
|
|||
def test_units_percent(): | |||
"""Test that '%' is converted to 'percent' """ |
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.
Just a few lint issues, need a period of the docstring.
"""Test that '%' is converted to 'percent' """ | |
"""Test that '%' is converted to 'percent'.""" |
metpy/tests/test_xarray.py
Outdated
def test_units_percent(): | ||
"""Test that '%' is converted to 'percent' """ | ||
test_var_percent = xr.open_dataset(get_test_data('irma_gfs_example.nc', | ||
as_file_obj=False))['Relative_humidity_isobaric'] |
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.
This line is too long...
as_file_obj=False))['Relative_humidity_isobaric'] | |
test_var_percent = xr.open_dataset( | |
get_test_data('irma_gfs_example.nc', | |
as_file_obj=False))['Relative_humidity_isobaric'] |
this update converts '%' units to 'percent' units within the MetPy xarray accessor. Fixes Unidata#1038.
Took care of those lint issues. Should be good to go. |
Travis failure is just matplotlib. Merging over it. |
Because pint does not support '%' as a unit, this update converts DataArray units that are provided as such to 'percent'.
Fixes #1038.