fhs / NPZ.jl

A Julia package that provides support for reading and writing Numpy .npy and .npz files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unsupported type O8

denizyuret opened this issue · comments

I tried loading a data file, which should have arrays of floats and bools, and got the following error (with additional debug output): Is this something easy to fix?

!julia> a=npzread("for_deniz.npz")
(:parseheader,s) = (:parseheader,"'descr': '|O8', 'fortran_order': False, 'shape': (3250, 2), }")
(:parseheader,key,s) = (:parseheader,"descr",": '|O8', 'fortran_order': False, 'shape': (3250, 2), }")
(:parsedtype,s) = (:parsedtype,"'|O8', 'fortran_order': False, 'shape': (3250, 2), }")
(:parsedtype,dtype,s) = (:parsedtype,"|O8",", 'fortran_order': False, 'shape': (3250, 2), }")
(:parsedtype,c,t) = (:parsedtype,'|',"O8")
ERROR: parsing header failed: unsupported type O8
in parsedtype at /state/partition1/dyuret/.julia/v0.4/NPZ/src/NPZ.jl:122
in parseheader at /state/partition1/dyuret/.julia/v0.4/NPZ/src/NPZ.jl:146
in npzreadarray at /state/partition1/dyuret/.julia/v0.4/NPZ/src/NPZ.jl:180
in npzread at /state/partition1/dyuret/.julia/v0.4/NPZ/src/NPZ.jl:221
in npzread at /state/partition1/dyuret/.julia/v0.4/NPZ/src/NPZ.jl:201

The "O" in "|O8" stands for python objects. See http://docs.scipy.org/doc/numpy/reference/arrays.interface.html#arrays-interface

I'm afraid this is going to be hard to support in Julia, if not impossible. I recommend saving the floats and bools separately into two different arrays instead of an array objects.