Description
What is your issue?
I generally want indexed objects to have different dimension names than their original ones, so index quite often with .sel(original_dim_name=("new_dim_name", indexing_array))
instead of creating a dataarray for indexing_array
with "new_dim_name" as dimension.
This doesn't seem to work with slice objects though: .sel(original_dim_name=("new_dim_name", slice(4, None, 2)))
errors out with
ValueError: Variable None: Could not convert tuple of form (dims, data[, attrs, encoding]): ('new_dim_name', slice(4, None, 2)) to Variable.
I am not sure if the tuple syntax is discouraged and should be avoided altogether or if it would be possible to support that. From the error message and the indexing rules it seems whichever implementation actually happens for the conversion of slices into arrays could kick in for the 2nd element in the case of tuples and before the creation of the Variable
object in order to support this case.