usnistgov/h5wasm

Does h5wasm support complex value write into DateSet

jianghuife opened this issue · 1 comments

when I read Dateset which is a complex value, and I want to copy it to other DataSet, it went wrong 'unguessable type for data'

If you are talking about a complex number like python 1 + 1j, then these are handled in h5py by mapping them onto an HDF5 Compound type, with two members named 'r' and 'i'. There is no built-in datatype for complex numbers in HDF5.

h5wasm supports reading these datasets, returning an Array of Array objects (e.g. [[1,1], [1, 0.5]...] for a complex stored value of [1+1j, 1+0.5j...]. All compound datasets are converted to nested arrays on read.

There is no support in h5wasm for writing compound datatypes, and it would take some effort to write it (requiring a method of specifying a new compound datatype, creating it in the HDF5 C API, converting the input data into the proper byte representation and writing). There is also no implemented concept of 'copying' an h5wasm.Dataset to another HDF5 file or another group in the same file.

For reference, the currently supported datatypes for creating and writing datasets in h5wasm includes:

  • 1,2,4 and 8 byte integers (signed and unsigned)
  • 2, 4 and 8-byte floats
  • fixed-length and variable-length strings

For reading, it also supports Compound and Array datatypes.