Skip to content

Complex dtype error  #244

Closed
Closed
@alimanfoo

Description

@alimanfoo

Minimal, reproducible code sample, a copy-pastable example if possible

zarr.array(1j*np.arange(10))

Problem description

Above code snippet generates an exception:

TypeError: Object of type 'complex128' is not JSON serializable

This is due to the default fill value of zero being cast as complex before attempting to store as fill value in JSON. Workaround is to set fill_value=None when creating the array.

Version and installation information

Please provide the following:

  • Value of zarr.__version__: 2.2.0
  • Value of numcodecs.__version__: 0.5.4
  • Version of Python interpreter: 3.6
  • Operating system (Linux/Windows/Mac): Linux
  • How Zarr was installed (e.g., "using pip into virtual environment", or "using conda"): pip into venv

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPotential issues with the zarr-python library

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions