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
UxDataset.isel() silently fails to slice when providing grid dim not in the dataset #1713
Calling UxDataset.isel() to select along a grid dimension other than the grid dimension where the data is currently located successfully returns a UxDataset with the grid sliced properly, but the data not sliced at all. For example, for data with "n_face" dimension, slicing at n_edge=7 as mentioned in the docstring (added in #1684) leads to a result with uxgrid having only the two faces touching edge 7, but with "n_face" data dimension untouched.
I confirmed that this bug was not introduced by #1684; it exists on main even before that commit was merged. The behavior is inconsistent with UxDataArray.isel(), which instead also slices the "n_face" data dimension appropriately to keep the uxgrid and data in synch.
What did you expect to happen?
I expected the data to sliced appropriately such that the result's data contains precisely the edges/nodes/faces corresponding to the result's uxgrid.
Can you provide a MCVE to repoduce the bug?
importuxarrayasuxds=ux.tutorial.open_dataset("outCSne30-vortex")
assert"n_face"inds.dimsresult=ds.isel(n_edge=7)
print((result.sizes["n_face"], result.uxgrid.n_face))
# expected (2, 2), got (5400, 2).# Note: when using UxDataArray, there is no issue. This works just fine:arr=ds["psi"]
result=arr.isel(n_edge=7)
print((result.sizes["n_face"], result.uxgrid.n_face))
# prints (2, 2) as expected.
Activity
Fix isel() bugs: missing indexers' coords; UxDataset.isel() silently …