Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bool type is not supported #64

Closed
jkotan opened this issue Jul 17, 2018 · 0 comments
Closed

bool type is not supported #64

jkotan opened this issue Jul 17, 2018 · 0 comments
Labels

Comments

@jkotan
Copy link
Collaborator

jkotan commented Jul 17, 2018

It is hardly possible to write bool-type fields without converting it into integer. For example

from pninexus import h5cpp

fapl = h5cpp.property.FileAccessList()
fcpl = h5cpp.property.FileCreationList()
flag = h5cpp.file.AccessFlags.TRUNCATE
fl = h5cpp.file.create("bool_h5cpp.h5", flag, fcpl, fapl)

rt = fl.root()

shape = [1, 1]

dcpl = h5cpp.property.DatasetCreationList()

dataspace = h5cpp.dataspace.Simple(
    tuple(shape), tuple([h5cpp.dataspace.UNLIMITED] * len(shape)))

chunk = shape
dcpl.layout = h5cpp.property.DatasetLayout.CHUNKED
dcpl.chunk = tuple(chunk)

field = h5cpp.node.Dataset(
    rt, h5cpp.Path("bool3"), h5cpp.datatype.kInt8, dataspace,
    dcpl=dcpl)
field.write([[True]])
fl.close()

throws

Traceback (most recent call last):
  File "bool_h5cpp.py", line 24, in <module>
field.write([[True]])
  File "/usr/lib/python2.7/dist-packages/pninexus/h5cpp/node/__init__.py", line 276, in dataset_write
memory_type = datatype.kFactory.create(data.dtype)
  File "/usr/lib/python2.7/dist-packages/pninexus/h5cpp/datatype/__init__.py", line 71, in create
return self.type_map[dtype.name]
KeyError: 'bool'

It is somehow related to ess-dmsc/h5cpp#354 and ess-dmsc/h5cpp#260

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant