You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to access a dataset which contains an enum array via h5serv, however h5pyd throws the following exception:
File "$HOME/project/venv/lib/python2.7/site-packages/h5pyd-0.2.6-py2.7.egg/h5pyd/_hl/group.py", line 335, in __getitem__
tgt = getObjByUuid(link_json['collection'], link_json['id'])
File "$HOME/project/venv/lib/python2.7/site-packages/h5pyd-0.2.6-py2.7.egg/h5pyd/_hl/group.py", line 311, in getObjByUuid
tgt = Dataset(DatasetID(self, dataset_json))
File "$HOME/project/venv/lib/python2.7/site-packages/h5pyd-0.2.6-py2.7.egg/h5pyd/_hl/dataset.py", line 416, in __init__
self._dtype = createDataType(self.id.type_json)
File "$HOME/project/venv/lib/python2.7/site-packages/h5pyd-0.2.6-py2.7.egg/h5pyd/_hl/h5type.py", line 725, in createDataType
dt = createDataType(field['type']) # recursive call
File "$HOME/project/venv/lib/python2.7/site-packages/h5pyd-0.2.6-py2.7.egg/h5pyd/_hl/h5type.py", line 732, in createDataType
dtRet = createBaseDataType(typeItem) # create non-compound dt
File "$HOME/project/venv/lib/python2.7/site-packages/h5pyd-0.2.6-py2.7.egg/h5pyd/_hl/h5type.py", line 638, in createBaseDataType
raise TypeError("Array Type base type must be integer, float, or string")
TypeError: Array Type base type must be integer, float, or string
We can create a minimal dataset to reproduce the error using h5py as follows:
We then put it in h5serv's data directory and try to access it:
import h5pyd
f = h5pyd.File("test.hdfgroup.org", endpoint="http://127.0.0.1:5000")
print(f['test'])
This yields the above exception. Note that we are able to access the dataset as expected using regular h5py.
Applying the following patch to h5pyd prevents the exception and returns a dataframe, however it doesn't seem to give the correct behavior (the enum array seems to be treated as an int array):
diff --git a/h5pyd/_hl/h5type.py b/h5pyd/_hl/h5type.py
index 4ce6cb4..10ce562 100644
--- a/h5pyd/_hl/h5type.py
+++ b/h5pyd/_hl/h5type.py
@@ -637 +637 @@ def createBaseDataType(typeItem):
- if arrayBaseType["class"] not in ('H5T_INTEGER', 'H5T_FLOAT', 'H5T_STRING'):
+ if arrayBaseType["class"] not in ('H5T_INTEGER', 'H5T_FLOAT', 'H5T_STRING', 'H5T_ENUM'):
I'm not sure how to properly proceed in working around this. Thanks in advance for your advice.
The text was updated successfully, but these errors were encountered:
Yes, it seems that the metadata is lost if we access it that way. However, if I write f['test']['my_enum_array'].dtype.metadata (or equivalently, h5py.check_dtype(enum=f['test']['my_enum_array'].dtype)), the enum dictionary is retrieved as expected. This is pretty confusing behavior indeed.
I am trying to access a dataset which contains an enum array via h5serv, however h5pyd throws the following exception:
We can create a minimal dataset to reproduce the error using h5py as follows:
We then put it in h5serv's data directory and try to access it:
This yields the above exception. Note that we are able to access the dataset as expected using regular h5py.
Applying the following patch to h5pyd prevents the exception and returns a dataframe, however it doesn't seem to give the correct behavior (the enum array seems to be treated as an int array):
I'm not sure how to properly proceed in working around this. Thanks in advance for your advice.
The text was updated successfully, but these errors were encountered: