There is no way to tag individual columns (i.e. fields in a compound data type). And you certainly can't insert strings where doubles are expected. What I've done is to tag the dataset with an H5A attribute (an array of strings, one per field). In my case each string is the Unit associated with the field.
Scott From: Hdf-forum [mailto:[email protected]] On Behalf Of Gaurav Bhalla Sent: Sunday, May 04, 2014 10:40 PM To: [email protected] Subject: [Hdf-forum] Writing a string to an HDF5 file. I am trying to write an HDF5 file. The file basically contains a large timeseries matrix in the following format TimeStamp Property1 Property2 I have managed to write the data successfully, I created a dset and used the H5Dwrite function. Now my question is how do I create a file header, in other words, if I want to write the following array to the file... ['TimeStamp', 'Property1', 'Property2'] ...and tag it to the columns for ease of later use ( I am planning to analyze the matrix in Python). How to do that? I tried to use H5Dwrite to write a string array but failed, I guess it wanted consistent datatypes, so it just wanted floats, which is the datatype for my data. Then I read about this metadata thing, but I am a bit lost as to how to use it? Any help would be much appreciated. A related side question is can the first row of a matrix be a string and the others rows contain doubles? ________________________________ This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of Exelis Inc. The recipient should check this e-mail and any attachments for the presence of viruses. Exelis Inc. accepts no liability for any damage caused by any virus transmitted by this e-mail.
_______________________________________________ Hdf-forum is for HDF software users discussion. [email protected] http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
