Skip to content

Commit c7b9128

Browse files
committed
Fixes #890 by trying to conform valid units first.
1 parent b2b8175 commit c7b9128

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cf/data/data.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4407,7 +4407,9 @@ def arctan2(cls, x1, x2):
44074407
x2: array_like
44084408
X coordinates. *x1* and *x2* must be broadcastable to
44094409
a common shape (which becomes the shape of the
4410-
output).
4410+
output). If both *x1* and *x2* have units, they must
4411+
be in the same dimension (can be conformed), else
4412+
they will be treated as unitless.
44114413
44124414
:Returns:
44134415
@@ -4434,6 +4436,10 @@ def arctan2(cls, x1, x2):
44344436
[90.0 -90.0]
44354437
44364438
"""
4439+
4440+
if isinstance(getattr(x2, "Units", None), Units):
4441+
x1 = conform_units(x1, x2.Units)
4442+
44374443
try:
44384444
y = x1.to_dask_array()
44394445
except AttributeError:

0 commit comments

Comments
 (0)