#NEWLINE# def _hdf_write( h5 , data , name = 'data' , group = '/datasets' ) : #NEWLINE# #INDENT# import tables #NEWLINE# atom = tables . Atom . from_dtype ( data . dtype ) #NEWLINE# filt = tables . filters . Filters ( complevel = 9 , complib = 'blosc' , shuffle = True ) #NEWLINE# create = False #NEWLINE# try : #NEWLINE# #INDENT# ds = h5 . getNode ( ( '%s/%s' % ( group , name ) ) ) #NEWLINE# ds [ : ] = data #NEWLINE# #UNINDENT# except tables . NoSuchNodeError : #NEWLINE# #INDENT# create = True #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# h5 . removeNode ( ( '%s/%s' % ( group , name ) ) ) #NEWLINE# create = True #NEWLINE# #UNINDENT# if create : #NEWLINE# #INDENT# ds = h5 . createCArray ( group , name , group , data . shape , filters = filt , createparents = True ) #NEWLINE# ds [ : ] = data #NEWLINE# #UNINDENT# return ds