Skip to content

figure out what to do about h5py dtype having metadata.vlen in order to get pynwb validator to work with Lindi #53

Description

@magland

See #47

and see code comments here

if ret.kind == 'O':
if not ret.metadata:
# The following correction is needed because of
# this code in hdmf/backends/hdf5/h5tools.py:
# def _check_str_dtype(self, h5obj):
# dtype = h5obj.dtype
# if dtype.kind == 'O':
# if dtype.metadata.get('vlen') == str and H5PY_3:
# return StrDataset(h5obj, None)
# return h5obj
# We cannot have a dtype with kind 'O' and no metadata
# There is also this section in pynwb validator.py
# if isinstance(received, np.dtype):
# if received.char == 'O':
# if 'vlen' in received.metadata:
# received = received.metadata['vlen']
# else:
# raise ValueError("Unrecognized type: '%s'" % received)
# received = 'utf' if received is str else 'ascii'
# elif received.char == 'U':
# received = 'utf'
# elif received.char == 'S':
# received = 'ascii'
# else:
# received = received.name
# ------------------------------------------
# I don't know how to figure out when vlen should be str or bytes
# but validate seems to work only when I put in vlen = bytes
#
vlen = bytes
ret = np.dtype(str(ret), metadata={'vlen': vlen})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions