If this helps, here is a simple command line converter:
If it is made executable, it acts as expected. It requires NumPy and h5py.

Pierre

#!/usr/bin/env python
from sys import argv

if (__name__=="__main__"):
    if (len(argv)<3):
print "Usage: ascii_data_to_h5.py 'file with ascii tabular data' outfile.h5"
        print "This program converts ascii data to a HDF5 file."
        exit()
    import numpy as np
    import h5py
    data = np.loadtxt(argv[1])
    h5file = h5py.File(argv[2],'w')
    h5file['data'] = data
    h5file.close()


Le 18 août 11 à 10:24, Daniel Kahn a écrit :

pacomet wrote:
Hi everyone

I'm trying to convert an ASCII data file (/m rows x n columns/) to an hdf5 file. I've read about h5fromtxt but it only seems to get data from standard input (console). Is it possible to pass an ASCII file as input to h5fromtxt?


Greetings,

Try h5import.

If you need to do even moderate manipulation or parsing of the ASCII file you should consider using Python with h5py/numpy. This is what I use now instead of h5import.

--dan


Thanks in advance

--
View this message in context: http://hdf-forum. 184993.n3.nabble.com/Converting-from-ASCII-to-hdf5-h5fromtxt- tp3264997p3264997.html
Sent from the hdf-forum mailing list archive at Nabble.com.

_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org


--
Daniel Kahn
Science Systems and Applications Inc.
301-867-2162


_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

-----------------------------------------------------------
Pierre de Buyl
Chemical Physics Theory Group - University of Toronto
Physique des Systèmes Complexes et Mécanique Statistique - Université Libre de Bruxelles
web: http://homepages.ulb.ac.be/~pdebuyl/
Tel: +1-416-946-0047
-----------------------------------------------------------




_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Reply via email to