Skip to content

Add h5read test to demo h5read failure#91

Merged
jbeilstenedmands merged 5 commits intomainfrom
demo_h5read_fail
Mar 30, 2026
Merged

Add h5read test to demo h5read failure#91
jbeilstenedmands merged 5 commits intomainfrom
demo_h5read_fail

Conversation

@jbeilstenedmands
Copy link
Copy Markdown
Collaborator

While trying to develop a baseline integrator, I was having issues reading images with h5read, encountering this error:

HDF5-DIAG: Error detected in HDF5 (1.14.6) thread 1:
  #000: H5D.c line 602 in H5Dget_space(): unable to synchronously get dataspace
    major: Dataset
    minor: Can't get value
  #001: H5D.c line 563 in H5D__get_space_api_common(): invalid dataset identifier
    major: Invalid arguments to routine
    minor: Inappropriate type
  #002: H5VLint.c line 1786 in H5VL_vol_object_verify(): identifier is not of specified type
    major: Invalid arguments to routine
    minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.14.6) thread 1:
  #000: H5D.c line 713 in H5Dget_type(): invalid dataset identifier
    major: Invalid arguments to routine
    minor: Inappropriate type
  #001: H5VLint.c line 1786 in H5VL_vol_object_verify(): identifier is not of specified type
    major: Invalid arguments to routine
    minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.14.6) thread 1:
  #000: H5T.c line 2440 in H5Tget_size(): not a datatype
    major: Invalid arguments to routine
    minor: Inappropriate type
Error: Expected 16-bit data but got 0 bytes. Use -DPIXEL_DATA_32BIT=ON for 32-bit data.

However I notice that if I revert the recent changes to h5read, the function works fine and can read the data without problem. I guess either the metadata in the file is not quite right, or things aren't quite initialized correctly, but it's not clear from the changeset what the issue precisely is.

This PR has two commits, the first adds a test which fails, the second reverts the h5read commit as a demo that commit it is the cause. I'm not planning to merge this PR as is, but would be good to add the test file once the issue is resolved.

To run the test after building: ctest -L h5read-tests --output-on-failure

@jbeilstenedmands
Copy link
Copy Markdown
Collaborator Author

Ok, it turns out I was holding it wrong. I had copied the pattern from miniapp, but recent h5read changes mean that you need to call is_image_available before trying to read the data, else you get the error I encountered.

I think introducing this test is still helpful to demonstrate correct usage, however we should probably update a few other things:

  • miniapp.cc presumably no longer works
  • the h5read Readme does not reference this as it was written before recent changes, so this should be updated.
  • I feel it could be more logical if the get_image method changed to return an std::optional<Image> rather than Image - then it could do the is_image_available check internally and return appropriately.

@jbeilstenedmands jbeilstenedmands merged commit cad19b3 into main Mar 30, 2026
4 checks passed
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

Successfully merging this pull request may close these issues.

1 participant