Skip to content

Commit ee1bb5c

Browse files
committed
Adjust ufunc error message
Based on the correct observation in pydata#8179 (comment) (slightly adjusted message)
1 parent e00e31b commit ee1bb5c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

xarray/core/computation.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from xarray.core.alignment import align, deep_align
1818
from xarray.core.common import zeros_like
1919
from xarray.core.duck_array_ops import datetime_to_numeric
20+
from xarray.core.formatting import limit_lines
2021
from xarray.core.indexes import Index, filter_indexes_from_coords
2122
from xarray.core.merge import merge_attrs, merge_coordinates_without_align
2223
from xarray.core.options import OPTIONS, _get_keep_attrs
@@ -769,8 +770,8 @@ def func(*arrays):
769770
raise ValueError(
770771
f"applied function does not have the number of "
771772
f"outputs specified in the ufunc signature. "
772-
f"Result is not a tuple of {signature.num_outputs} elements:\n\n"
773-
f"{short_array_repr(result_data)}"
773+
f"Received a {type(result_data)} with {len(result_data)} elements instead:\n\n"
774+
f"{limit_lines(result_data, limit=10)}"
774775
)
775776

776777
objs = _all_of_type(args, Variable)

0 commit comments

Comments
 (0)