neophyte problem reading dataset

Hi

I’m writing some C code with HDF5 1.10 (though the problem is also there with 1.8).

One set of files contains -

              DATASET "pixel_mask" {
                 DATATYPE  H5T_STD_U32LE
                 DATASPACE  SIMPLE { ( 256, 1024 ) / ( 256, 1024 ) }
                 DATA {
                 (0,0): 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                 (0,16): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                 etc...

h5dump -n shows that pixel_mask is here -
dataset /entry/instrument/detector/detectorSpecific/pixel_mask

I can read the values in pixel_mask okay if I declare pixel_mask in my code -

signed int pixel_mask = (signed int)malloc(sizeof(signed int) * xpixels * ypixels);
and read

H5LTread_dataset_int(hdf, “/entry/instrument/detector/detectorSpecific/pixel_mask”, pixel_mask);

The second set of files contain a different type of entry for the pixel_mask, indicated by an “EXTERNAL_LINK” (but the same data also occurs in the referencing file) -

        EXTERNAL_LINK "pixel_mask" {
           TARGETFILE "image_1508_meta.hdf5"
           TARGETPATH "mask"
              DATASET "mask" {
                 DATATYPE  H5T_STD_U32LE
                 DATASPACE  SIMPLE { ( 2167, 2070 ) / ( 2167, 2070 ) }
                 DATA {
                 (0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                 (0,16): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

and h5dump -n gives

ext link /entry/instrument/eiger/pixel_mask -> image_1508_meta.hdf5 mask

and exactly the same construction of C code will not read the data into the array indicated by the malloc.

I’ve tried reading the array directly from the linked file, but have had no more success.

I must be doing something wrong :wink: but I’ve run out of ideas.

Hi

Can anyone help? This is still a problem for me…

Where is your executable running from and where are the files? The TARGETFILE is a relative path, perhaps it is not finding the dependent file because the executable is not in the same directory as the files, and or the files are not in the expected relative locations? Are you using HDF5_EXT_PREFIX to give the library hints about where to find the files?
https://support.hdfgroup.org/HDF5/doc/RM/RM_H5L.html#Link-CreateExternal

Hi

Sorry about the delay in replying - I’m tied up for the next couple of weeks.

It doesn’t make a difference if I run the executable in the same directory as the HDF5 files or from another location. I don’t think this can be the issue, because the image data (also pointed to by a TARGETFILE with a relative path) for my image are in the same directory as the file containing the image mask information, and the image data are all found okay, independent of where I run the program. But if I’m wrong, that would make it easier to fix…

Thanks for the hint, I’ll look into it…

Harry