Skip to content

zarr.save() fails with object arrays #1155

@JamiePringle

Description

@JamiePringle

Zarr version

2.8.1

Numcodecs version

0.9.1

Python Version

3.9

Operating System

Linux

Installation

conda

Description

If I make a Numpy object array, and save it with zarr.save(), the save fails because the object_codec has not been defined for the array when it is created in the zarr store. I am not sure if this is to become a documentation bug (i.e. don't save object arrays with zarr.save()) or an implementation bug. To trigger the bug, just do

import zarr
import numpy as np
jnk=np.empty((9,),dtype=object)
x=[()]*9 ; x[3]=(1,2)
jnk[:]=x
zarr.save('jnk.zarr',it=jnk)

And it will fail with a ValueError: missing object_codec for object array

Ultimately, I think this will be an easy fix; but I don't quite feel comfortable enough with this code base to just dive in and suggest a permanent fix.

Jamie

Steps to reproduce

see above

Additional output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPotential issues with the zarr-python librarydocumentationImprovements to the documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions