Closed
Description
I did not follow the code deeply, but there clearly seems to be a huge overhead when indexing such arrays. In particular, in the following code
import xarray as xr
import numpy as np
a = xr.DataArray([None for k in range(100)],dims='c')
for k in range(a.c.size):
a[k] = xr.DataArray(np.random.randn(1000,5),dims=['a','b'])
%prun a[0]
the indexing operation takes about 1 second on my machine, or 2 seconds when running under the profiler. The profiler output shows lots of functions with a recursive call count exceeding 100'000 (most likely iterating through each row of the contained sub-arrays). However, there is really no reason to iterate through the nested elements.
Metadata
Metadata
Assignees
Labels
No labels