1

我正在使用以下代码从磁盘中分割一个 Zarr 数组:

import zarr as zr

db = zr.open('/content/drive/My Drive/Share/Daily Data/Database/dbz.zarr', mode='r')
data = db[db[:,0]==20171003]

这是错误:

IndexError                                Traceback (most recent call last)
<ipython-input-16-4ae364a8c3b1> in <module>()
      1 dbz_ranked = zr.open('/content/drive/My Drive/Share/Daily Data/Database/dbz_ranked.zarr', mode='w', shape=(8245164, 345),chunks=(100000, 345), dtype='float64')
----> 2   data = db[db[:,0]==20171003]


3 frames
/usr/local/lib/python3.6/dist-packages/zarr/indexing.py in __init__(self, selection, array)
    280                 raise IndexError('unsupported selection item for basic indexing; '
    281                                  'expected integer or slice, got {!r}'
--> 282                                  .format(type(dim_sel)))
    283 
    284             dim_indexers.append(dim_indexer)

IndexError: unsupported selection item for basic indexing; expected integer or slice, got <class 'numpy.ndarray'>

我不知道为什么这不起作用,我认为 Zarr 应该像 Numpy 数组一样切片?

4

0 回答 0