import time import unittest import numpy from refill import open_hdf5 import numpy as np class MyTestCase(unittest.TestCase): def test_h5py(self): file = '/var/www/html/data/stdata/channel.hdf5' hfive = open_hdf5(file, False) x = list(hfive.keys()) print(x) def test_chunk(self): file = '/var/www/html/data/stdata/test.hdf5' hfive = open_hdf5(file, True) dset = hfive.create_dataset('chunkede', (8, 86400),chunks=(8,3600)) print(dset.chunks) print(time.time()) for i in range(8): for j in range(86400): dset[i,j] = i*j hfive.flush() hfive.close() print(time.time()) def test_read(self): file = '/var/www/html/data/stdata/test.hdf5' hfive = open_hdf5(file, False) print(time.time()) dset = hfive['chunked'] ndata = numpy.zeros((8,86400)) ndata[:, :] = dset print(dset.chunks) hfive.close() print(time.time()) def test_auto_chunk(self): file = '/var/www/html/data/stdata/test.hdf5' hfive = open_hdf5(file, True) dset = hfive.create_dataset('chunkede', (8, 86400),chunks=True) print(dset.chunks) print(time.time()) for i in range(8): for j in range(86400): dset[i,j] = i*j hfive.flush() hfive.close() print(time.time()) def test_version(self): import h5py x = h5py.__version__ print(x) if __name__ == '__main__': unittest.main()