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/5034#issuecomment-822729940,https://api.github.com/repos/pydata/xarray/issues/5034,822729940,MDEyOklzc3VlQ29tbWVudDgyMjcyOTk0MA==,4441338,2021-04-19T19:33:14Z,2021-04-19T19:33:14Z,NONE,"@dcherian I tried to reproduce, with this minimal example I couldn't, so I'm closing the issue.
```python
import xarray as xr
import numpy as np
n0 = 10
n1 = 3
x1 = xr.DataArray(np.empty((n0,n1),dtype=np.float64),dims=('dim0','dim1')).chunk({'dim0':2})
x2 = xr.DataArray(np.empty(n0,dtype=bool),dims=('dim0',)).chunk({'dim0':2})
n2 = 10
def f(x1,x2):
return np.empty(n2,dtype=x1.dtype),np.empty(n2,dtype=np.min_scalar_type(n2))
m,w = xr.apply_ufunc(
f,
x1,x2,
input_core_dims=[('dim0','dim1'),('dim0',)],
output_core_dims=[('dim2',),('dim2',)],
vectorize=True,
dask='parallelized',
dask_gufunc_kwargs={
'output_sizes':{'dim2':n2},
'allow_rechunk':True,
# 'meta':(np.empty((M,),dtype=p.dtype),np.empty((M,),dtype=np.min_scalar_type(M)))
# 'output_dtypes':[p.dtype,np.min_scalar_type(M)],
},
output_dtypes=[x1.dtype,np.min_scalar_type(n2)] # now works
# output_dtypes=(x.dtype,np.min_scalar_type(ny)) # works
)
m.compute(),w.compute()
```
```
(
array([1.e-323, 2.e-323, 3.e-323, 4.e-323, 5.e-323, 6.e-323, 7.e-323,
8.e-323, 9.e-323, 1.e-322])
Dimensions without coordinates: dim2,
array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1], dtype=uint8)
Dimensions without coordinates: dim2)
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,831148018
https://github.com/pydata/xarray/issues/5034#issuecomment-822130302,https://api.github.com/repos/pydata/xarray/issues/5034,822130302,MDEyOklzc3VlQ29tbWVudDgyMjEzMDMwMg==,2448579,2021-04-19T02:49:32Z,2021-04-19T02:49:32Z,MEMBER,@LunarLanding can you add a minimal example illustrating the problem?,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,831148018
https://github.com/pydata/xarray/issues/5034#issuecomment-798999639,https://api.github.com/repos/pydata/xarray/issues/5034,798999639,MDEyOklzc3VlQ29tbWVudDc5ODk5OTYzOQ==,10194086,2021-03-14T23:23:05Z,2021-03-14T23:23:05Z,MEMBER,"Hmm would be good to get a MVCE - may be a dask problem. Dask allows a `""list of dtypes""` according to its docstring.
- `dask.array.apply_gufunc`: _output_dtypes : Optional, dtype or list of dtypes, keyword only_
- `np.vectorize`: _otypes : str or list of dtypes, optional_
---
Unfortunately `np.vectorize` is not (yet) typed, but in anycase (and independent of your error report) we should probably write this as `Sequence[DTypeLike]` (or another container) using `xr.core.npcompat.DTypeLike` ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,831148018
https://github.com/pydata/xarray/issues/5034#issuecomment-798973169,https://api.github.com/repos/pydata/xarray/issues/5034,798973169,MDEyOklzc3VlQ29tbWVudDc5ODk3MzE2OQ==,5635139,2021-03-14T20:22:04Z,2021-03-14T20:22:04Z,MEMBER,"Thanks @LunarLanding .
Does anyone who knows this better have a view on whether we should accept a list? In lieu of that, we can change the type definition. @LunarLanding would you be up for a small PR?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,831148018