Skip to content

Zarr can not handle 0 dimension like numpy does #150

@will133

Description

@will133

In certain cases, numpy can return a dimension that is 0. This is different from reducing the dimension so the dimension is missing. Therefore, in numpy you can have shape like (1000, 0, 0), which is actually empty data-wise but it is internally consistent. In such case zarr seems to fail:

In [68]: import zarr
In [69]: arr = zarr.empty((1000, 0, 0), dtype='float64')
/.../site-packages/zarr/util.py:48: RuntimeWarning: divide by zero encountered in log10
  target_size = CHUNK_BASE * (2**np.log10(dset_size/(1024.*1024)))

where it would work in numpy:

In [70]: import numpy
In [71]: arr = numpy.empty((1000, 0, 0), dtype='float64')
In [72]: print arr
[]
In [73]: print arr.shape
(1000, 0, 0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions