Duplicate dimension names for easy data subsetting #9603
Unanswered
MeyerBender
asked this question in
Q&A
Replies: 1 comment
-
One solution for this problem could be to have |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I want to store an adjacency matrix in an xarray object, which should have the same dimensions at the x and y coordinate. Here is a minimal example:
Note that with this example, I get the following warning:
I know that I could just do
dims=['cells_1', 'cells_2']
. However, I later want to subset my cells, and have this affect both the x and y axis. So something likeda.sel(cells=['cell1', 'cell3'])
should work. The reason why I do not want to distribute this over multiple variables is that mycells
coordinate actually also appears in some otherDataArrays
, and I want everything to be synchronized.The subsetting I described above does seem to work correctly, however the warning has me a bit concerned. What are the best practices in this case? Is it fine to ignore the warning, as subsetting on the cells will be my main use case? What are some instances where this duplicate-name approach might fail?
Thank you very much for your help!
Beta Was this translation helpful? Give feedback.
All reactions