def to_hdf5(filename, *args, **kwargs):
 if ((len(args) == 1) and isinstance(args[0], dict)):
  data = args[0]
 elif ((len(args) == 2) and isinstance(args[0], str) and isinstance(args[1], Array)):
  data = {args[0]: args[1]}
 else:
  raise ValueError("Please provide {'/data/path': array} dictionary")
 chunks = kwargs.pop('chunks', True)
 import h5py
 with h5py.File(filename) as f:
  dsets = [f.require_dataset(dp, shape=x.shape, dtype=x.dtype, chunks=(tuple([c[0] for c in x.chunks]) if (chunks is True) else chunks), **kwargs) for (dp, x) in data.items()]
  store(list(data.values()), dsets)

def to_hdf5 ( filename , * args , ** kwargs ) : if ( ( len ( args ) == 1 ) and isinstance ( args [ 0 ] , dict ) ) : data = args [ 0 ] elif ( ( len ( args ) == 2 ) and isinstance ( args [ 0 ] , str ) and isinstance ( args [ 1 ] , Array ) ) : data = { args [ 0 ] : args [ 1 ] } else : raise ValueError ( "Please provide {'/data/path': array} dictionary" ) chunks = kwargs . pop ( 'chunks' , True ) import h5py with h5py . File ( filename ) as f : dsets = [ f . require_dataset ( dp , shape = x . shape , dtype = x . dtype , chunks = ( tuple ( [ c [ 0 ] for c in x . chunks ] ) if ( chunks is True ) else chunks ) , ** kwargs ) for ( dp , x ) in data . items ( ) ] store ( list ( data . values ( ) ) , dsets )
store arrays in hdf5 file this saves several dask arrays into several datapaths in an hdf5 file .