VSCode extension for HDF5


#1

Like many of you, I’m looking forward to the upcoming HDF5 Users Group event at ITER at the end of the month. After two days of exciting presentations, we are planning CodeCamp and Hands-on style sessions. Perhaps we can combine an idea that’s been in the air for some time with such a concentration of brilliant community minds and devote one session to exploring the idea of a Visual Studio Code extension for HDF5. If that idea has occurred or appeals to you, or even if you think this is a terrible idea, we would like to hear from you on this thread! Show us your (anti-)use cases, related efforts, and attempts! Share your concerns and reservations! Anything that helps us to get a headstart on this on June 2 will be welcome. And join us on the day, if you can! The registration for virtual attendance is still open.

Best, G.


HDFView on Windows not displaying fixed length UTF-8 string correctly
#2

Interesting idea! Do you have in mind a debugger extension that would let you show e.g. file/dataset properties on hover of file/dataset variable? BTW is it possible to tell the underlying type form just a hid_t?


#3

H5Iget_type() will tell you the type (H5I_type_t) of an HDF5 hid_t ID.


#4

A Visual Studio Code extension for HDF5 exists:

https://marketplace.visualstudio.com/items?itemName=lochbrunner.vscode-hdf5-viewer-highfive


#5

Excellent! Thank you for the reference. This is a great starting point for our discussion. I’ll try to contact the author. G.


#6

Regarding visualizing HDF5 variables from the debugger, which does not sound to be the purpose of the proposed extension, it looks like VSCode support the Natvis Framework, shared with Visual Studio.

So one would have to create a custom views of C++ objects in the debugger using the Natvis framework.

Does anyone know if such effort already exists?


#7

Hello all,

Most of you probably know H5Web, the web-based viewer for HDF5 files that we presented at several HUG instances.
We are pleased to announce that we recently released a VSCode extension (based on h5wasm) to be able to explore HDF5 files in VSCode with H5Web: https://github.com/silx-kit/vscode-h5web

You are all welcome to install this extension and give us your feedback :slight_smile:


#8

@loic.huder Here’s a query: do you think this could possibly be extended to support netCDF4 files? I mean, those are HDF5 files (in a sense? Not sure of the complete relationship), and I can h5dump a netCDF4 file…so maybe?

I only ask because where I am is a netCDF4 shop, and having this capability might be quite nice to quick-look our files.

Note: I did try a simple "rename file to test.h5" but the extension threw Expected valid HDF5 file. :slight_smile:


#9

From what I remember, netCDF4 is a subset of HDF5 (anyone, please correct me if I am wrong?) so the support for such files may be possible.

We can have a look at the feasibility. As I am not too familiar with the format, could you provide a link to netCDF4 we could use for testing ?

Nice try :smile:


#10

Yes, netCDF4 is an exact subset of HDF5.
https://docs.unidata.ucar.edu/nug/current/file_structure_and_performance.html#parts_of_netcdf4

"Rename file to test.h5" should have worked, in fact it should have also worked without the rename, unless the extension is fussy. @matthew.thompson, assuming you are on a linux-type system, what does “file test.h5” or “file test.nc” say?


#11

@dave.allured I was testing this on macOS and:

❯ diff -s test.h5 test.nc4
Files test.h5 and test.nc4 are identical
❯ file test.nc4
test.nc4: Hierarchical Data Format (version 5) data
❯ file test.h5
test.h5: Hierarchical Data Format (version 5) data

So, as far as file is concerned, they are the same type of file.


#12

@matthew.thompson I tried the extension with a NetCDF file and it worked fine.

Please open an issue on the repo: https://github.com/silx-kit/vscode-h5web (ideally by attaching a sample file). This way, we will be able to track more easily the necessary steps to solve this.


#13

@loic.huder Well this is…interesting. For some reason now, I can open the renamed test.h5 file in VS Code. I’m…not sure what changed. I mean, I did “Restart to update” it because Microsoft asked me to.

So, uh, thanks for your cool work!

Still, I think I might make a feature request for your extension so it can open .nc4 files like it can .h5 files.

(And of course, my dream would be if it saw the file had lats and lons to put the data on a project of the earth but that might be asking too much :smiley:)


#14

Even dumber, I now realize your extension supports opening test.nc! So now my feature request is: “Support opening .nc4 files!”

I’m feeling nice and dumb today. :slight_smile:


#15

Note that this should be user configurable via workbench.editorAssociations. See the updated README.