Skip to content

Add comparison for Xarray folks#1

Merged
VeckoTheGecko merged 5 commits into
mainfrom
push-wsytwnlmollx
Jun 9, 2026
Merged

Add comparison for Xarray folks#1
VeckoTheGecko merged 5 commits into
mainfrom
push-wsytwnlmollx

Conversation

@VeckoTheGecko

@VeckoTheGecko VeckoTheGecko commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Adding a comparison here to discuss with the Xarray folks at some point. See README

Keen to chat about this @fluidnumericsJoe in our meeting today

cc @erikvansebille

@VeckoTheGecko

Copy link
Copy Markdown
Contributor Author

Was just exploring another avenue - what if we used a different backend (i.e., "cubed" instead of "dask") to see what that performance looks like.

I ran into this error out of the box

python xarray-profile.py
Traceback (most recent call last):
...
  File "/Users/Hodgs004/coding/repos/xarray-interpolation/xarray-profile.py", line 187, in run
    ds.isel(positions).compute()
    ~~~~~~~^^^^^^^^^^^
  File "/Users/Hodgs004/coding/repos/xarray-interpolation/.pixi/envs/default/lib/python3.14/site-packages/xarray/core/dataset.py", line 2867, in isel
    return self._isel_fancy(indexers, drop=drop, missing_dims=missing_dims)
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/Hodgs004/coding/repos/xarray-interpolation/.pixi/envs/default/lib/python3.14/site-packages/xarray/core/dataset.py", line 2923, in _isel_fancy
    new_var = var.isel(indexers=var_indexers)
  File "/Users/Hodgs004/coding/repos/xarray-interpolation/.pixi/envs/default/lib/python3.14/site-packages/xarray/core/variable.py", line 1141, in isel
    return self[key]
           ~~~~^^^^^
  File "/Users/Hodgs004/coding/repos/xarray-interpolation/.pixi/envs/default/lib/python3.14/site-packages/xarray/core/variable.py", line 831, in __getitem__
    data = indexing.apply_indexer(indexable, indexer)
  File "/Users/Hodgs004/coding/repos/xarray-interpolation/.pixi/envs/default/lib/python3.14/site-packages/xarray/core/indexing.py", line 1182, in apply_indexer
    return indexable.vindex[indexer]
           ~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/Users/Hodgs004/coding/repos/xarray-interpolation/.pixi/envs/default/lib/python3.14/site-packages/xarray/core/indexing.py", line 467, in __getitem__
    return self.getter(key)
           ~~~~~~~~~~~^^^^^
  File "/Users/Hodgs004/coding/repos/xarray-interpolation/.pixi/envs/default/lib/python3.14/site-packages/xarray/core/indexing.py", line 1783, in _vindex_get
    raise TypeError("Vectorized indexing is not supported")
TypeError: Vectorized indexing is not supported

due to these lines https://github.com/pydata/xarray/blob/a1408234d1dc786965bfb6311f8782561ee0e676/xarray/core/indexing.py#L1782-L1783 . Seems that vectorized indexing is relatively new to the array API (data-apis/array-api#669 , data-apis/array-api#900) but there are still some limitations that (I think) prevent us from doing vectorized indexing - hopefully Stephan or someone can shed more light ehre.

Anyway - extracting the cubed array, trying the following (as expected) doesn't work either:

data = ds.U_grid_data.data
data[[2,3],[2,3],[2,3],[2,3]]
*** NotImplementedError: Only one integer array index is allowed.

@VeckoTheGecko VeckoTheGecko merged commit aae04bf into main Jun 9, 2026
@VeckoTheGecko VeckoTheGecko deleted the push-wsytwnlmollx branch June 11, 2026 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant