The setup:
I have an xarray dataset with dimensions x,y,t called foo
the selection command
bar = foo.isel(t = 2)
selects a single slice along the t axis and stores the results in bar
My Issue:
bar only has dimensions x,y
I would like to use t after the selection for quick recombination of many slices
Expectation:
bar has dimensions x,y,t (The same dimensions as its superset)
Each individual slice of
foohas an associatedtcoordinate value in a real world setting. An individual slicebarfromfooshould preserve thattcoordinate so that if a dataset was split for whatever reason, it can be recombined in the future.Predictable/consistent behaviour regarding
sel's orisel's treatment of dimension would mean less manual checking.
Questions
(1) The documentation references a kwarg called **indexers_kwargs. Is there more specific documentation on what is accepted under **indexers_kwargs? I'm having trouble finding the definitive list or a definition that makes sense. My hopes are that there may exist a kwarg used to preserve the t value when using sel or isel. Does such a thing exist?
(2) Currently the approach I'm considering is wrapping isel or sel with a function that can preserve dims with only one value. Would be much happier if it were natively supported. Can you imagine/propose an alternative workaround?