-
-
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
Concat doesn't concatenate dimension coordinates along new dims #7539
Comments
In general I also find that
I guess easiest for a concat version with no auto-alignment would be to drop the index when such case happens. (note: one problem in your example is that the Xarray data model still does not allow having a multi-dimensional "time" variable with "time" as also one of its dimensions, but this could be now relaxed). I've been also wondering whether some kind of |
We could get halfway to a better I propose
This would also drastically improve |
I think we should do this regardless. I don't know of anywhere in the docs that these kind of subtleties with
Right - in this case that would have given the intuitive result.
That wouldn't have helped with this specific issue though right? |
That's true, If we do want this use-case to work out of the box, then I too agree that a new top-level method would be best. |
What is your issue?
xr.concat
doesn't concatenate dimension coordinates along new dimensions, which leads to pretty unintuitive behavior.Take this example (motivated by #7532 (reply in thread))
I would have expected to get a result of size
{new: 2, time: 4, cols: 2}
. That would be intuitive, because the default iscoords='different'
, and that would be the result of concatenating eachtime
coordinate (which have different values) and just propagating thecols
coordinate (as they have the same values).Instead what happened is that
xr.concat
treats the dimension coordinates as indexes to align, and defaults to an outer join. This auto-alignment behaviour has been discussed at length before, I'm just trying to point out another place in which its problematic.This is kind of briefly mentioned in the concat docstring under
coords='all'
:but it's not even mentioned under
coords='different'
I don't really know what I would prefer to happen with the coordinates. I guess to have created a
time
coordinate of size{new: 2, time: 4, cols: 2}
, but then I don't know what that implies for the underlying index. @benbovy do you have any thoughts?At the very least we should make this a lot clearer in the docs.
The text was updated successfully, but these errors were encountered: