-
-
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
Reusing coordinate doesn't show in the dimensions #1499
Comments
Yes, this is a bug. But note that you will probably run into other issues with repeated dimension names. It's not explicitly forbidden by the data model, but various operation (like broadcasting) will fail, possibly in unpredictable ways. Another example would be There's no reason why you shouldn't be able to support these for at least some subset of operations, but it will need some attention from an interested party. |
I'm concerned about trying to support any of this behavior. I think any use of the datamodel with duplicate dimensions will be very buggy. Logic like this is all over the place: def get_axis_num(self, dim)
if isinstance(dim, basestring):
return self._get_axis_num(dim) In your example, you'd want this method to return |
This is important for some of my use cases, it's something we do a lot--as noted it is not forbidden by the netcdf format or CF standards. |
@acrosby - any interest in helping add support for this use case in xarray? Starting point would be to write some tests that target this use case. Then there will be bugs to fix... |
@jhamman I'm interested in helping, but I definitely can't be timely unless we can get a project here at work that I can leverage for time. What were you thinking for test coverage? |
Simple things that match your use-cases. For example: indexing, arithmetic, aggregating over an axis, transpose, concatenating, saving/loading files, plotting. The xarray docs could be a good place to start to make sure you aren't missing anything big. |
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 |
I think I side with @jhamman now on this issue. Labeled access to this kind of dataarray and broadcasting operations are not useful in my cases, and working in straight numpy or pandas ends up making more sense. We just drop the appropriate variables upon opening the relevant files. |
Just flying by and dropping a note because I just ran into this with Imaris Open files being created by a microscope camera. I wanted to use one of my favorite packages (xarray) to dig into the data, and noted the dimension reuse. Not a big blocker, but this functionality of the data format might be growing in usage. More details on Imaris. |
Closed by #8491 |
For a
DataArray
, when reusing a coordinate for multiple dimensions (is this expected usage?), it only shows once in the repr:I think it should be
Otherwise, everything appears to work exactly as I would expect.
This isn't an issue for
Datasets
:Thanks!
The text was updated successfully, but these errors were encountered: