Re: writing a structure on an HDF5 file [message #57782] |
Sun, 30 December 2007 20:49  |
Dave Haffner
Messages: 1 Registered: December 2007
|
Junior Member |
|
|
djanches,
In principle you can do the following to create an hdf5 compound
datatype out of your structure which you can get back using h5_parse
(w/ the READ_DATA keyword, of course). Your structure will be under
the _data tag.
btw, I wish HDF5 was the default IDL output format, or at least a
choice. Matlab affords this already.
Hope this is some help,
Dave
; write a structure to hdf5 as a compound datatype
file = 'filename.h5'
fid = H5F_CREATE(file)
datatype_id = H5T_IDL_CREATE(structdata)
dataspace_id=H5S_CREATE_SIMPLE(1) ; not so simple..
dataset_id = H5D_CREATE(fid,'datastr',datatype_id,dataspace_id)
H5D_WRITE, dataset_id, structdata
H5S_CLOSE, dataspace_id
H5T_CLOSE, datatype_id
H5F_CLOSE, fid
; check out the file
s=h5_parse('filename.h5',/read_data)
help, /structure, s.datastr._data
On Dec 29, 8:12 pm, djanc...@gmail.com wrote:
> I recently started working with HDF5 files and seems that all what I
> learned about managing regular HDF files in the past is not directly
> applied to HDF5.
> What I am trying to do is in theory simple.
> I am trying to write a structure into an HDF5 file. The structure
> contains all sort of data (i.e, arrays, integers, and some strings).
> I was wondering if there is a simple manner to create a new hdf5 file,
> put the structure in it and close it. Something that I could later
> open it and use the HDF5 Parse command to read the entire structure at
> once.
|
|
|