You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's a bit annoying — frequently I attempt to select something, realize it doesn't have an index, add the .set_xindex call, try and remember to add each one at object creation, feel like xarray isn't being as helpful as it could be.
Describe the solution you'd like
Could we instead set the xindex automatically when calling .sel
Possibly we want to force the user to create this once, rather than paying the cost of creating a new index on each call? But OTOH it seems relatively cheap?
(I guess it could be possible to update a cache in place, and then creating a new index from the cache would be very cheap. Though also possibly that's a source of quite confusing behavior if our implementation is in any way wrong / people are sharing objects across threads etc — i.e. the principle of "don't update in place" is useful)
Describe alternatives you've considered
A set_xindex(...) param (i.e. literally an ellipsis ...) that just creates all the indexes that it can, and folks could call after creating an object?
Additional context
No response
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem?
I'm trying to use
xindex
more. Currently, trying to select values using coordinates that haven't been explicitly indexed viaset_xindex()
raises:After explicitly setting the index, it works as expected:
It's a bit annoying — frequently I attempt to select something, realize it doesn't have an index, add the
.set_xindex
call, try and remember to add each one at object creation, feel like xarray isn't being as helpful as it could be.Describe the solution you'd like
Could we instead set the xindex automatically when calling
.sel
Possibly we want to force the user to create this once, rather than paying the cost of creating a new index on each call? But OTOH it seems relatively cheap?
(I guess it could be possible to update a cache in place, and then creating a new index from the cache would be very cheap. Though also possibly that's a source of quite confusing behavior if our implementation is in any way wrong / people are sharing objects across threads etc — i.e. the principle of "don't update in place" is useful)
Describe alternatives you've considered
A
set_xindex(...)
param (i.e. literally an ellipsis...
) that just creates all the indexes that it can, and folks could call after creating an object?Additional context
No response
The text was updated successfully, but these errors were encountered: