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
{{ message }}
Repository navigation
isel() fails with slice object, in UxDataArray and UxDataset #1639
Slicing UxDataArray or UxDataset using .isel() and providing a slice object fails with TypeError: int() argument must be a string, a bytes-like object or a real number, not 'slice'.
What did you expect to happen?
I expected .isel() to properly select the indicated indices even when a slice object is used to indicate them.
Combining .isel() with .plot() seems like a decent way to visualize "which faces are which?" For example, I might use uxarr.isel(n_face=slice(0, 100, 5)) to understand how faces 0, 5, 10, ... are laid out in the grid.
Can you provide a MCVE to repoduce the bug?
importuxarrayasuxds=ux.tutorial.open_dataset("outCSne30-vortex")
ds.isel(n_face=slice(None, None, 10)) # should get every 10th face.# but actually, crashes with TypeError.arr=ds['psi']
arr.isel(n_face=slice(2, 15, 3)) # should get faces 2, 5, 8, 11, 14# but actually, crashes with TypeError.# maybe helpful to note, the following seems to work just fine:arr.isel(n_face=[2,5,8,11,14])
(Not showing UxDataset in example here because slicing UxDataset by a dimension which is not one of the data dimensions is currently bugged, as reported in #1713, and this example has data along dimension "n_face".)
Activity
fix misc bugs with sel() implementation
Fix: `.sel()` now actually slices the uxgrid too, for UxDataArray and…
Sevans711 commentedon Sep 2, 2026
Update: discovered that this bug only applies when providing slice object for "n_face" indexer (regardless of data location).
For example, the following works just fine:
(Not showing UxDataset in example here because slicing UxDataset by a dimension which is not one of the data dimensions is currently bugged, as reported in #1713, and this example has data along dimension "n_face".)
Fix isel() bugs: accept slices and boolean arrays, and do not smash i…