You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on #2185 (comment), I was thinking the error message should probably be updated to something more like
For a given variable `x`, if `x` is an xarray DataArray, you can assign units as follows:
from metpy.units import units
x = x * units("m/s")
If `x` is a NumPy Masked Array, you can assign units instead as:
x = units.Quantity(x, "m/s")
If `x` is a scalar or any other common array type, either of the above approaches will
work. For more information, see the "Working with Units" tutorial in MetPy's documentation.
The order of the two suggestions can definitely be flipped based on what we expect/want a user to default to.
The text was updated successfully, but these errors were encountered:
Conclusion from telecon discussion: check against type of x for it being a masked array to do the constructor suggestion, otherwise suggest multiplication approach. In both cases, include some hint towards the docs.
[...] #2333 made me notice that the following error message in
check_units
is incorrect:MetPy/src/metpy/units.py
Lines 262 to 264 in 94ef0e0
This approach to assigning units will not (and is never intended to) work for xarray data types. [...]
Originally posted by @jthielen in #2185 (comment)
Based on #2185 (comment), I was thinking the error message should probably be updated to something more like
The order of the two suggestions can definitely be flipped based on what we expect/want a user to default to.
The text was updated successfully, but these errors were encountered: