-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stack: avoid re-chunking (dask) and insert new coordinates arbitrarily #4389
Comments
dask seems to rechunk when reshaping
The core stack operation is here: xarray/xarray/core/variable.py Lines 1456 to 1478 in 2acd0fc
I think the dimension is at the end for coding convenience... |
There has been some discussion on the dask chunking issue here: Regarding the position of the inserted variable, it is not related to the chunking. It seems possible to do this. Would this be an acceptable change? If so, the first problem is the signature, as multiple dimensions may be passed in. :/ |
In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity If this issue remains relevant, please comment here or remove the |
Amazing. Thanks @phofl |
The behavior of stack was not quite intuitive to me, and I'd like to understand if this was an explicit technical decision or if it can be changed.
First, with regard to chunking:
Why did the number of chunks change in this case? Couldn't the chunksize be (1,1)?
Next, why is it necessary to put the new dimension at the end? It seems there are often more natural (perhaps just to my naive thought process) placements. One example would be that same array above, but stacked on the first two dimensions. I would want the new dimension to be the first dimension (again without the rechunking above). To accomplish this, I do:
The dask graph for this last bit insert a rechunk and two transposes, but my intent was not to have any of the underlying chunks change at all. Here is 1 of 8 pieces of the graph (with optimization off -- optimization combines operations, but doesn't change the topology or the operations):
Is it technically feasible for stack to avoid rechunking, and for the user to determine where the new dimensions should go?
The text was updated successfully, but these errors were encountered: