Blosc / bcolz

A columnar data container that can be compressed.
http://bcolz.blosc.org
959 stars 149 forks source link

how to get my carray data back afterr flush? #415

Open kaybinwong opened 3 years ago

kaybinwong commented 3 years ago

i can not get my carray data back after flush, the code is below

import numpy as np
import bcolz

bcolz.print_versions()
arrt = np.dtype('int32,int32') 
src_data = [(i, i * i) for i in range(10)]
carr = bcolz.carray(src_data, dtype=arrt, rootdir='./css', mode='w')
carr.flush()
carr2 = bcolz.open(rootdir='./css', mode='r')
carr2

errors

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
bcolz version:     1.2.1
NumPy version:     1.20.1
Blosc version:     1.14.3 ($Date:: 2018-04-06 #$)
Blosc compressors: ['blosclz', 'lz4', 'lz4hc', 'snappy', 'zlib', 'zstd']
Numexpr version:   2.7.3
Dask version:      2021.03.0
Python version:    3.7.9 (default, Mar 10 2021, 23:54:50) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
Platform:          linux-x86_64
Byte-ordering:     little
Detected cores:    4
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-71-d6a707a69c8c> in <module>
      2 import bcolz as bz
      3 
----> 4 carr2 = bcolz.open(rootdir='./css', mode='r')
      5 carr2

~/.local/lib/python3.7/site-packages/bcolz/toplevel.py in open(rootdir, mode)
    138         return bcolz.ctable(rootdir=rootdir, mode=mode)
    139     else:
--> 140         return bcolz.carray(rootdir=rootdir, mode=mode)
    141 
    142 

bcolz/carray_ext.pyx in bcolz.carray_ext.carray.__cinit__()

bcolz/carray_ext.pyx in bcolz.carray_ext.carray._read_meta()

TypeError: data type "[('f0', '<i4'), ('f1', '<i4')]" not understood

what had i done wrongly? how to get my carray data back afterr flush? #415 help, ths in advantage

kaybinwong commented 3 years ago

image is the doc correct?

kaybinwong commented 3 years ago

see pr #416