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
When using UxDataArray.isel(indexers) or UxDataset.isel(indexers) with a pre-defined indexers dict, the dict itself is edited, so repeating the same .isel() code multiple times leads to different results.
What did you expect to happen?
I expected the indexers dict to not be modified directly.
The fix should be simple; inside .isel() methods, use a copy of indexers instead of popping grid_dim from the original.
Can you provide a MCVE to repoduce the bug?
obj=ux.tutorial.open_dataset('quad-hexagon') # obj is a UxDatasetchosen_faces= {'n_face': 0}
resultA=obj.isel(chosen_faces)
resultB=obj.isel(chosen_faces)
print((resultA.sizes['n_face'], resultB.sizes['n_face']))
# expected (1, 1), got (1, 4)print(chosen_faces)
# expected {'n_face': 0}, got {}# same issue occurs with UxDataArray, e.g. try above with obj=obj['t2m']
Activity
Fix isel() bugs: accept slices and boolean arrays, and do not smash i…