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/1995#issuecomment-373871784,https://api.github.com/repos/pydata/xarray/issues/1995,373871784,MDEyOklzc3VlQ29tbWVudDM3Mzg3MTc4NA==,1217238,2018-03-16T23:32:07Z,2018-03-16T23:32:07Z,MEMBER,">Modify apply_ufunc: remove the check that the input_core_dims must not be chunked add parameter output_chunks My main concern is ensuring that someone does not inadvertently apply a function not designed for multiple chunks to dask arrays. For example, suppose the function being applied is `np.median`. Some loud flag that makes it very obvious what's going on seems like a good idea, e.g., `possibly_chunked_core_dims=['x']`? Then we also need some sort of guarantee that chunked core dimensions aren't entirely removed, or else xarray/dask won't know how to stack them back up. I guess we could check to make sure that at least as many output core dimensions appear as appear in inputs cor edimensions?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,305757822 https://github.com/pydata/xarray/issues/1995#issuecomment-373579142,https://api.github.com/repos/pydata/xarray/issues/1995,373579142,MDEyOklzc3VlQ29tbWVudDM3MzU3OTE0Mg==,1217238,2018-03-16T01:55:44Z,2018-03-16T01:55:44Z,MEMBER,"Try: ```python import dask.array import numpy as np def mulsum_chunk(a, b): return np.einsum('...i,...i', a, b)[..., np.newaxis] def mulsum(a, b): # needs broadcasting/rechunking for a,b mapped = dask.array.map_blocks(mulsum_chunk, a, b, dtype=float, chunks=a.chunks[:-1] + (tuple(1 for _ in a.chunks[-1]),)) return dask.array.sum(mapped, axis=-1) ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,305757822 https://github.com/pydata/xarray/issues/1995#issuecomment-373578226,https://api.github.com/repos/pydata/xarray/issues/1995,373578226,MDEyOklzc3VlQ29tbWVudDM3MzU3ODIyNg==,1217238,2018-03-16T01:50:07Z,2018-03-16T01:50:07Z,MEMBER,"> could you make an example? That was my first thought but I could not figure out how to make the apply_ufunc do it. OK, thinking a little more about it, this would not work with `dask='parallelized'` which does not allow for chunking over core dimensions. You would have parallelize the function with dask yourself, e.g., with `dask.array.map_blocks`, but then you could use apply_ufunc with `dask='allowed'`.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,305757822 https://github.com/pydata/xarray/issues/1995#issuecomment-373572878,https://api.github.com/repos/pydata/xarray/issues/1995,373572878,MDEyOklzc3VlQ29tbWVudDM3MzU3Mjg3OA==,1217238,2018-03-16T01:16:57Z,2018-03-16T01:16:57Z,MEMBER,"One way to allow chunking across `x` would be to finish up `dask.array.einsum`: https://github.com/dask/dask/issues/732 I'm reluctant to add `reduce_func` to xarray because it isn't clear to me exactly what the underlying abstraction is. It's something like a gufunc, but does a little bit more. Also, ideally we'd like this to be in dask.array, maybe as part of `dask.array.apply_gufunc` (https://github.com/dask/dask/pull/3109). For this specific problem, I *think* you could solve it with `xarray.apply_ufunc` by writing something like a gufunc that keeps the reduced axis as size 1 to apply to each chunk, and afterwards summing up along that dimension.","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,305757822 https://github.com/pydata/xarray/issues/1995#issuecomment-373569090,https://api.github.com/repos/pydata/xarray/issues/1995,373569090,MDEyOklzc3VlQ29tbWVudDM3MzU2OTA5MA==,1217238,2018-03-16T00:53:34Z,2018-03-16T00:53:34Z,MEMBER,"For two inputs, don't we use dask.array.tensordot?","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,305757822 https://github.com/pydata/xarray/issues/1995#issuecomment-373568240,https://api.github.com/repos/pydata/xarray/issues/1995,373568240,MDEyOklzc3VlQ29tbWVudDM3MzU2ODI0MA==,1217238,2018-03-16T00:48:12Z,2018-03-16T00:48:12Z,MEMBER,Have you tried the new `xarray.dot()`? That might be even faster for this case.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,305757822