Last active
January 7, 2020 18:17
-
-
Save andrewgiessel/7515520 to your computer and use it in GitHub Desktop.
simple example to use pytables to save a numpy array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tables | |
import numpy as np | |
# Store "all_data" in a chunked array... | |
# from: http://stackoverflow.com/questions/8843062/python-how-to-store-a-numpy-multidimensional-array-in-pytables | |
f = tables.openFile('all_data.hdf', 'w') | |
atom = tables.Atom.from_dtype(all_data.dtype) | |
filters = tables.Filters(complib='blosc', complevel=5) | |
ds = f.createCArray(f.root, 'all_data', atom, all_data.shape, filters=filters) | |
# save w/o compressive filter | |
#ds = f.createCArray(f.root, 'all_data', atom, all_data.shape) | |
ds[:] = all_data | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
shouldn't it be
f.create_carray()
not `createCArray()~?