LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with partial reads of HDF5 dataset

Solved!
Go to solution

I'm having a problem figuring out how to to a partial read of an HDF5 dataset using LVHDF5 by Jason S. I can save a dataset in a file, and I can read it out whole, but I can't figure out how to read a portion of it. For example

:

I save a 235x235x1024 dataset in a file. I want to read a 5x5x1024 array from this dataset. I am trying the following:

 

- use H5Dopen.vi to open the dataset

- use H5Dget_space.vi to get a reference to a dataspace that I assume (guess) is the dataspace associated w/ the dataset

- use H5Sselect_hyperslab.vi to select my 5x5x1024 portion using the "block" input. My starting location is 0,0,0 and stride and count are 1,1,1
- use Create Matching DataSpace.vi to create a dataspace that is 5x5x1024 in size, with the same datatype as my dataset (float).

- read the data in the "hyperslab" into an array using H5Dread.vi followed by the Variant to Data function.

 

If I don't wire the file space input, H5Dread.vi reads the whole dataset.  However, if I try to use the reference obtained w/ H5Dget_space.vi as the file space, I get an error from Variant to Data that says "The data type of the variant is not compatible with the data type wired to the type input.". 

 

I would appreciate any help in getting this to work.

 

 

0 Kudos
Message 1 of 2
(2,591 Views)
Solution
Accepted by topic author dbrewe

Aha. I found my problem. I have to use H5Dselect_hyperslab in my memory space as well as my file space.

0 Kudos
Message 2 of 2
(2,590 Views)