Skip to content

[Compound] Colons with numeric labels in wrong order #1765

@DrizzleatDusk

Description

@DrizzleatDusk

Describe the bug

I find a disarrangement of the columns when I want to display a structured numpy array.

To Reproduce

The bug can be reproduced by the following python code.

# create a structured array.
dtype = np.dtype(
    {"names": ['1', '0', '2'], "formats": [np.float64, np.float64, np.float64]}
)
data = np.array([(1.0, 2.0, 3.0), (4.0, 5.0, 6.0)], dtype=dtype)

# save.
file = h5py.File("./test.h5", 'w')
file.create_dataset("a", data=data, dtype=dtype)
file.close()

Expected behaviour

We can read from the file as follows:

file = h5py.File("./test.h5", 'r')
print(file["a"]["0"])     #[2. 5.]
print(file["a"]["1"])     #[1. 4.]
print(file["a"]["2"])     #[3. 6.]
file.close()

Screenshots

Image

There is no problem using non numeric string. But in the above example, it seems that the columns are rearranged according to the values of the array index, which I think is a confusing behavior.

Context

I run the above example in the vscode plugin. (h5web.vscode-h5web v0.1.7)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions