Uh oh!
There was an error while loading. Please reload this page.
Add invariant check for IndexVariable.name - #8906
Conversation
benbovy
commented
Apr 4, 2024
Thanks @dcherian, that's a good check to have I think. Most (if not all?) errors seem to be multi-index level variables that wrongly have their dimension name set as IndexVariable |
| """ | ||
| __slots__ = () | ||
| __slots__ = ("_name",) |
There was a problem hiding this comment.
Can we remove the name property instead or is that much much harder?
There was a problem hiding this comment.
This would be better indeed but this is likely more work (not sure how much, though).
IndexVariable still needs a deeper refactor (#8124), or even be eventually dropped?
There was a problem hiding this comment.
Where is the .name property used?
There was a problem hiding this comment.
After a quick check: internally only in a few places (conventions / multiindex check, dataarray creation, maybe groupby?) actually.
Externally I have no idea (IndexVariable is public API in theory).
dcherian
commented
Jun 14, 2024
Here's a wilder idea: @property.getterdefname(self) ->Hashable:
name, =self._dimsreturnname@property.setterdefname(self):
# maybe warn for a while firstraiseNotImplementedError |
@benbovy this seems to be the root cause of #8646, the variable name in
Dataset._variablesdoes not matchIndexVariable.name.A good number of tests seem to fail though, so not sure if this is a good chck.
whats-new.rstapi.rst