jupyterlab/jupyterlab-hdf5

Display attributes more like datasets

aarchiba opened this issue · 6 comments

Problem

I have an HDF5 file that has attributes associated with the file itself (the top-level group), and with some groups. (Not data sets, although I know that is possible in HDF5.) When I open the file, these attributes are invisible; there is no indication that they are present. This is particularly awkward as one attribute of the file - README explains what all the datasets and attributes mean.

For the attributes of sub-groups, if I know that they are there I can right-click and query them. For the attributes of the File itself, I know of no way to access them through jupyter-hdf5.

I would like to be able to browse through the file, easily reading both the metadata stored in attributes and the contents of the datasets.

Proposed Solution

I suggest making attributes appear as "directory entries" of the objects that they are attached to, perhaps with a different icon than is used for datasets and sub-groups. It's not so simple to see how to do this for attributes of datasets, but if the file browser is still present the attributes should be visible there.

Additional context

Example attributes:

  • README - attribute of the top-level file, somewhat long text explaining what all is in the file
  • Fit parameters - attribute of the top-level file, list of strings giving the parameters that were fit, serving as column labels for one entry
  • DMX/DMX0001/DMX - attribute of a subgroup, a floating-point number giving the value of the named parameter.

The h5py package makes it easy to store strings and lists (arrays) of strings in attributes, but cumbersome to store them in datasets, so I suspect that the usage of attributes to store valuable metadata is common.

The HDFView program shows datasets, groups, and the file as a whole like directories and files; each has two tabs, one that lists the attributes and one that tells you about the dataset (if relevant).

Hello @aarchiba

So, for the record, attributes of entities can be seen by right-clicking on an entity in the file browser and click View attributes. If you do this operation elsewhere in the file browser (without selecting an entity), the attributes of the current group will be displayed, enabling to see the attributes of the root group (i.e. the file) if you did not navigate in another group.

I agree that this is not the most straight-forward UI. Your idea of having attributes as nodes in the browser seems promising but as you pointed out, I don't see how this would work for datasets...

Thank you for pointing that out, I think I had tried clicking on every visible feature but I hadn't tried clicking on none.

I do notice that the attributes display window doesn't scroll, so if you don't see it all in your window, tough luck.

Thank you for pointing that out, I think I had tried clicking on every visible feature but I hadn't tried clicking on none.

Yeah, as I said, not the best UI.

I do notice that the attributes display window doesn't scroll, so if you don't see it all in your window, tough luck.

That's indeed a problem but easily fixable. I could generate a HDF5 with many attributes myself but it would great if you could provide me an example file instead.

Then, I will be more able to see the issues you encounter by myself.

Scroll fixed in 1.3.0