Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion xarray/core/computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def apply_dataarray_vfunc(
data_vars = [getattr(a, "variable", a) for a in args]
result_var = func(*data_vars)

if signature.num_outputs > 1:
if signature.num_outputs != 1:
out = tuple(
DataArray(variable, coords, name=name, fastpath=True)
for variable, coords in zip(result_var, result_coords)
Expand Down
11 changes: 11 additions & 0 deletions xarray/tests/test_computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,17 @@ def test_vectorize_dask_new_output_dims():
)


def test_output_empty_tuple():
variable = xr.DataArray(np.arange(10), dims=["x"])

def empty_tuple(x):
return ()

expected = ()
actual = apply_ufunc(empty_tuple, variable, output_core_dims=[])
assert actual == expected


def test_output_wrong_number():
variable = xr.Variable("x", np.arange(10))

Expand Down