Skip to content

Special treatment of NaN in JSON user attributes #412

Closed
@meggart

Description

@meggart

This is a problem that showed up when testing the Zarr Julia interface. Currently nan-values in user-attribute values are not converted to strings (see example below), which does not adhere to JSON specs and causes the Julia JSON parser to fail. So I would suggest to do something analogous to the fill_value entry in .zarray, i.e. to either forbid nan in zarr user attributes or convert them to strings to make the resulting JSON valid.

import zarr
import numpy
z1 = zarr.open('attrtest')
z1.attrs['att1']=numpy.nan

with open('attrtest/.zattrs') as myfile:
    print(myfile.read())

Metadata

Metadata

Assignees

No one assigned

    Labels

    V2Affects the v2 branchbugPotential issues with the zarr-python library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions