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 1175093771,I_kwDOAMm_X85GCoIL,6391,apply_ufunc and Datasets with variables without the core dimension,2448579,closed,0,,,5,2022-03-21T09:13:02Z,2023-09-17T08:20:15Z,2023-09-17T08:20:14Z,MEMBER,,,,"### Is your feature request related to a problem? Consider this example ```python ds = xr.Dataset({""a"": (""x"", [1, 2, 3]), ""b"": (""y"", [1, 2, 3])}) xr.apply_ufunc(np.mean, ds, input_core_dims=[[""x""]]) ``` This raises ``` ValueError: operand to apply_ufunc has required core dimensions ['x'], but some of these dimensions are absent on an input variable: ['x'] ``` because core dimension `x` is missing on variable `b`. This behaviour makes it annoying to use `apply_ufunc` on Datasets. ### Describe the solution you'd like Add a new kwarg to `apply_ufunc` called `missing_core_dim` that controls how to handle variables without *all* input core dimensions. This kwarg could take one of two values: 1. `""raise""` - raise an error, current behaviour 2. `""copy""` - skip applying the function and copy the variable from input to output. 3. `""drop""`- skip applying the function and drop the variable. ### Describe alternatives you've considered _No response_ ### Additional context _No response_","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/6391/reactions"", ""total_count"": 3, ""+1"": 3, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue