html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue https://github.com/pydata/xarray/issues/5281#issuecomment-840507994,https://api.github.com/repos/pydata/xarray/issues/5281,840507994,MDEyOklzc3VlQ29tbWVudDg0MDUwNzk5NA==,74414841,2021-05-13T11:55:18Z,2021-05-13T12:07:38Z,NONE,"**### UPDATE 1: ###** I have also tried to chunk over the `nFlowElem` dimension instead of 'time'. Then I define the input and output core dimensions as written below: ``` input_core_dims=[['time','laydim'],[],[],['dim_0','dim_1'],['dim_0','dim_1']], output_core_dims=[['dim_0','dim_1','time','laydim']], ``` Now I ""only"" get an error concerning the size of my output (which is nolonger chunked). My output is nolonger chunked, because nFlowElem is lost after the interpolation. Consequently, the (600,560,1009,20) dataarray is too large for my work memory. Is there perhaps a way to have apply_ufunc chunk your output along any of the other dimensions? **### UPDATE 2: ###** Alternatively, I have tried to chunk over the time dimension (50 time steps) and I have removed all input/output core dimensions. And if I then define interp_to_grid as follows (to get the right input dimensions): def interp_to_grid(u,xc,yc,xint,yint): xc = xc[:,0,0,0,0] yc = yc[:,0,0,0,0] u = u[:,:,:,0,0] print(u.shape,xc.shape,xint.shape) #input shape ug = griddata((xc,yc),u,(xint,yint), method='nearest', fill_value=np.nan) print(ug.shape) #output shape return ug I do get the right dimensions for my `interp_to_grid`-input (see first line) and output (see second line). However, I get the `ValueError: axes don't match array`: (194988, 50, 20) (194988,) (600, 560) (600, 560, 50, 20) Traceback (most recent call last): File """", line 1, in uxg.loc[dict(time=np.datetime64('2014-09-18'),laydim=19)].plot() File ""C:\Users\920507\Anaconda3\envs\dfm_tools_env\lib\site-packages\xarray\plot\plot.py"", line 444, in __call__ return plot(self._da, **kwargs) File ""C:\Users\920507\Anaconda3\envs\dfm_tools_env\lib\site-packages\xarray\plot\plot.py"", line 160, in plot darray = darray.squeeze().compute() File ""C:\Users\920507\Anaconda3\envs\dfm_tools_env\lib\site-packages\xarray\core\dataarray.py"", line 899, in compute return new.load(**kwargs) File ""C:\Users\920507\Anaconda3\envs\dfm_tools_env\lib\site-packages\xarray\core\dataarray.py"", line 873, in load ds = self._to_temp_dataset().load(**kwargs) File ""C:\Users\920507\Anaconda3\envs\dfm_tools_env\lib\site-packages\xarray\core\dataset.py"", line 798, in load evaluated_data = da.compute(*lazy_data.values(), **kwargs) File ""C:\Users\920507\Anaconda3\envs\dfm_tools_env\lib\site-packages\dask\base.py"", line 565, in compute results = schedule(dsk, keys, **kwargs) File ""C:\Users\920507\Anaconda3\envs\dfm_tools_env\lib\site-packages\dask\threaded.py"", line 84, in get **kwargs File ""C:\Users\920507\Anaconda3\envs\dfm_tools_env\lib\site-packages\dask\local.py"", line 487, in get_async raise_exception(exc, tb) File ""C:\Users\920507\Anaconda3\envs\dfm_tools_env\lib\site-packages\dask\local.py"", line 317, in reraise raise exc File ""C:\Users\920507\Anaconda3\envs\dfm_tools_env\lib\site-packages\dask\local.py"", line 222, in execute_task result = _execute_task(task, data) File ""C:\Users\920507\Anaconda3\envs\dfm_tools_env\lib\site-packages\dask\core.py"", line 121, in _execute_task return func(*(_execute_task(a, cache) for a in args)) File ""C:\Users\920507\Anaconda3\envs\dfm_tools_env\lib\site-packages\dask\core.py"", line 121, in return func(*(_execute_task(a, cache) for a in args)) File ""C:\Users\920507\Anaconda3\envs\dfm_tools_env\lib\site-packages\dask\core.py"", line 121, in _execute_task return func(*(_execute_task(a, cache) for a in args)) File ""C:\Users\920507\Anaconda3\envs\dfm_tools_env\lib\site-packages\dask\optimization.py"", line 963, in __call__ return core.get(self.dsk, self.outkey, dict(zip(self.inkeys, args))) File ""C:\Users\920507\Anaconda3\envs\dfm_tools_env\lib\site-packages\dask\core.py"", line 151, in get result = _execute_task(task, cache) File ""C:\Users\920507\Anaconda3\envs\dfm_tools_env\lib\site-packages\dask\core.py"", line 121, in _execute_task return func(*(_execute_task(a, cache) for a in args)) File ""C:\Users\920507\Anaconda3\envs\dfm_tools_env\lib\site-packages\dask\utils.py"", line 35, in apply return func(*args, **kwargs) File ""<__array_function__ internals>"", line 6, in transpose File ""C:\Users\920507\Anaconda3\envs\dfm_tools_env\lib\site-packages\numpy\core\fromnumeric.py"", line 658, in transpose return _wrapfunc(a, 'transpose', axes) File ""C:\Users\920507\Anaconda3\envs\dfm_tools_env\lib\site-packages\numpy\core\fromnumeric.py"", line 58, in _wrapfunc return bound(*args, **kwds) ValueError: axes don't match array ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,882105903 https://github.com/pydata/xarray/issues/5281#issuecomment-840415339,https://api.github.com/repos/pydata/xarray/issues/5281,840415339,MDEyOklzc3VlQ29tbWVudDg0MDQxNTMzOQ==,74414841,2021-05-13T08:44:47Z,2021-05-13T08:45:07Z,NONE,"@mathause Thank you for your response! I believe that `map_blocks` only works for functions that consume and return xarray objects, right? Scipy.interpolate.griddata unfortunately does not return Xarray object. However, if there are other (xarray) functions which I could use to interpolate my results to a regular grid - I'd be very interested. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,882105903