id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type 1171916710,I_kwDOAMm_X85F2gem,6372,"apply_ufunc + dask=""parallelized"" + no core dimensions should raise a nicer error about core dimensions being absent",2448579,open,0,,,0,2022-03-17T04:25:37Z,2022-03-17T05:10:16Z,,MEMBER,,,,"### What happened? From https://github.com/pydata/xarray/discussions/6370 Calling `apply_ufunc(..., dask=""parallelized"")` with no core dimensions and dask input ""works"" but raises an error on compute (`ValueError: axes don't match array` from `np.transpose`). ``` python xr.apply_ufunc( lambda x: np.mean(x), dt, dask=""parallelized"" ) ``` ### What did you expect to happen? With numpy data the apply_ufunc call does raise an error: ``` xr.apply_ufunc( lambda x: np.mean(x), dt.compute(), dask=""parallelized"" ) ``` ``` ValueError: applied function returned data with unexpected number of dimensions. Received 0 dimension(s) but expected 1 dimensions with names: ('x',) ``` ### Minimal Complete Verifiable Example ``` python import xarray as xr dt = xr.Dataset( data_vars=dict( value=([""x""], [1,1,2,2,2,3,3,3,3,3]), ), coords=dict( lon=([""x""], np.linspace(0,1,10)), ), ).chunk(chunks={'x': tuple([2,3,5])}) # three chunks of different size xr.apply_ufunc( lambda x: np.mean(x), dt, dask=""parallelized"" ) ``` ### Relevant log output _No response_ ### Anything else we need to know? _No response_ ### Environment N/A","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/6372/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue