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

Represent byte order #227

Open
jdmarble opened this issue May 31, 2017 · 0 comments
Open

Represent byte order #227

jdmarble opened this issue May 31, 2017 · 0 comments

Comments

@jdmarble
Copy link

I work with data that is sometimes in non-native byte order. It looks like byte order can not yet be represented in a DataShape. I can get around this by using side channels like the keyword arguments in odo functions, but it would be more convenient to have byte order information as part of the shape.

Current Behavior

>>> ds.discover(np.array([1], dtype='u4'))
dshape("1 * uint32")
>>> ds.discover(np.array([1], dtype='=u4'))
dshape("1 * uint32")
>>> ds.discover(np.array([1], dtype='<u4'))
dshape("1 * uint32")
>>> ds.discover(np.array([1], dtype='>u4'))
dshape("1 * uint32")

Desired Behavior

One way to do this would be to mirror Numpy and default to the system byte order. This is being run on a little-endian system.

>>> ds.discover(np.array([1], dtype='u4'))
dshape("1 * uint32")
>>> ds.discover(np.array([1], dtype='=u4'))
dshape("1 * uint32")
>>> ds.discover(np.array([1], dtype='<u4'))
dshape("1 * uint32")
>>> ds.discover(np.array([1], dtype='>u4'))
dshape("1 * >uint32")

Numpy's behavior for reference:

>>> np.dtype('u4')
dtype('uint32')
>>> np.dtype('=u4')
dtype('uint32')
>>> np.dtype('<u4')
dtype('uint32')
>>> np.dtype('>u4')
dtype('>u4')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant