Hi Johan,

The second argument to H5Dwrite function (referring to C API, not C++) sets the type of single element which is expected in data buffer. If you set this to H5T_NATIVE_DOUBLE everything should be fine and data should be properly written since data buffer is just a pointer (void*).

https://support.hdfgroup.org/HDF5/doc/RM/RM_H5D.html#Dataset-Write

Usually -1 status means that you messed something with memory space and file space (3rd and 4th argument of H5Dwrite) and/or dataset dimensions. Please send some of your code examples (including how dataset is created) for further investigation...

Regards,
Rafal


W dniu 2017-10-18 o 14:21, Johan Lindberg pisze:
Hi,

Is there a way to write raw binary byte array data to an existing dataset of a different type? E.g., if I have a byte array that represents an array of doubles (the byte array thus has 8 times as many elements as the double array, where each set of 8 bytes represents a double), can I somehow write that data to a double dataset in an HDF5 file? Trying this the naïve way with HDF.write just returns a -1 status.

The reason why I don't just convert it to a double array before writing is that I have an instrument which returns all its data in byte arrays, no matter the type, and then I'd have to write a converter for each of the 10 different types it output in.

Thank you,
Johan Lindberg

--
Dr. Johan E. Lindberg


_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5



_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Reply via email to