Description
Dask is awesome, but it isn't always easy to use it for parallel operations. In many cases, especially when wrapping routines from external libraries, it is most straightforward to express operations in terms of a function that expects and returns xray objects loaded into memory.
Dask array has a map_blocks
function/method, but it's applicability is limited because dask.array doesn't have axis names for unambiguously identifying dimensions. da.atop
can handle many of these cases, but it's not the easiest to use. Fortunately, we have sufficient metadata in xray that we could probably parallelize many atop
operations automatically by inferring result dimensions and dtypes from applying the function once. See here for more discussion on the dask side: dask/dask#702
So I would like to add some convenience methods for automatic parallelization with dask of a function defined on xray objects loaded into memory. In addition to a map_blocks
method/function, it would be useful to add some sort of parallel_apply
method to groupby objects that works very similarly, by lazily applying a function that takes and returns xray objects loaded into memory.