Skip to content

Cannot read complex numbers #190

Open
@nhz2

Description

@nhz2

There is a bug in how complex numbers are being read.

Here is an example:

julia> using Zarr

julia> p = tempname()
"/tmp/jl_GLajCLonen"

julia> z1 = zcreate(Complex{Float32}, 10,10,path = p,chunks=(10, 10))
ZArray{ComplexF32} of size 10 x 10

julia> z1 .= 42f0*im
ZArray{ComplexF32} of size 10 x 10

julia> z2 = zopen(p)
ZArray{ComplexF64} of size 10 x 10

julia> z1[:,:] == z2[:,:]
false

julia> using JSON

julia> JSON.parsefile(joinpath(p, ".zarray"))["dtype"]
"<c8"

The "dtype" of the array is "<c8", so it is a complex number with a total of 8 bytes, or Complex{Float32} in Julia, but is getting incorrectly read as Complex{Float64}

This issue is fixed by PR #181

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