Skip to content

isel() fails with slice object, in UxDataArray and UxDataset #1639

Description

@Sevans711

Version

v2026.7.0

How did you install UXarray?

Source

What happened?

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?

import uxarray as ux
ds = 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])

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status
    📚 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions