Thanks a lot for the note. I am actually the same command, in visual express 2010 in a C++ console app, and it seems to work.
I am basically writing columnar data that is of the form TimeStamp Property1 Property2 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? And I am looking to do that C++. dset = H5Dcreate(file, "dset1", H5T_NATIVE_DOUBLE, file_space, H5P_DEFAULT, plist, H5P_DEFAULT); On Mon, May 5, 2014 at 11:04 AM, Binh-Minh Ribler <[email protected]>wrote: > Hi Gaurav, > > > If you're using the C++ API, your C statement > > dset = H5Dcreate(file, "dset1", H5T_NATIVE_DOUBLE, file_space, > H5P_DEFAULT, plist, H5P_DEFAULT); > > > would be something like this in C++: > > H5::DataSet dset = file.createDataSet("dset1", PredType::NATIVE_DOUBLE, > data_space, plist); > > You can find it here: > > > http://www.hdfgroup.org/HDF5/doc/cpplus_RM/classH5_1_1CommonFG.html#a12a4af21ca0231d4f2c4008b12177bb1 > > > Is that what you're looking for? > Binh-Minh > ------------------------------ > *From:* Hdf-forum <[email protected]> on behalf of > Gaurav Bhalla <[email protected]> > *Sent:* Monday, May 05, 2014 11:04 AM > *To:* HDF Users Discussion List > *Subject:* Re: [Hdf-forum] Writing a string to an HDF5 file. > > hanks a lot for your note, I appreciate your help. > > One more follow up question, I guess I am just hoping that you may be > able to help me. The issue is that I am basically writing the file from C++ > and then processing it downstream in Python. > > What would be the analogous statements in C++? > > I use this to create, > > dset = H5Dcreate(file, "dset1", H5T_NATIVE_DOUBLE, file_space, > H5P_DEFAULT, plist, H5P_DEFAULT); > > I am guessing I should be able to somehow use the H5A function here also? > > > > On Mon, May 5, 2014 at 9:55 AM, Mitchell, Scott - Exelis < > [email protected]> wrote: > >> 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 >> >> > > _______________________________________________ > Hdf-forum is for HDF software users discussion. > [email protected] > > http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org > >
_______________________________________________ Hdf-forum is for HDF software users discussion. [email protected] http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
