Query Existence of Dataset

HDF-Forum

I'm trying to query the existence of a particular compound dataset in an hdf5 file. I have tried using H5LTfind_dataset(hfile, "/sim/heart3d/sodium"), but it never returns a positive value for any combination(even for datasets I'm certain exists within the file). I need to know whether the dataset exists before I can issue a H5LTread_dataset(). Can anyone suggest the correct way to query the file for a dataset's existence?

Susheel

···

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

Hi Susheel,

···

On May 28, 2009, at 2:12 PM, Susheel Varma wrote:

HDF-Forum

I'm trying to query the existence of a particular compound dataset in an hdf5 file. I have tried using H5LTfind_dataset(hfile, "/sim/heart3d/sodium"), but it never returns a positive value for any combination(even for datasets I'm certain exists within the file). I need to know whether the dataset exists before I can issue a H5LTread_dataset(). Can anyone suggest the correct way to query the file for a dataset's existence?

  You should try using H5Lexists(), which will tell you if a link of a particular name exists in a group.

    Quincey

Susheel

HDF-Forum

I'm trying to query the existence of a particular compound dataset in
an hdf5 file. I have tried using H5LTfind_dataset(hfile, "/sim/heart3d/ sodium"), but it never returns a positive value for any
combination(even for datasets I'm certain exists within the file). I
need to know whether the dataset exists before I can issue a
H5LTread_dataset(). Can anyone suggest the correct way to query the
file for a dataset's existence?

Susheel

is it possible for you to send me your file?

Pedro

···

At 02:12 PM 5/28/2009, Susheel Varma wrote:

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

--------------------------------------------------------------
Pedro Vicente
The HDF Group
pvn@hdfgroup.org

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

Yay! That worked. Now, according to the docs, I have to iterate and verify the groups and sub-groups manually. I suppose I could write a function to H5Literate through the links from the root group of the file, string comparing along the way, else it will become tedious quite quickly.

So what does H5LTfind_dataset do really or differently?

Susheel

···

On 28 May 2009, at 20:55, Quincey Koziol wrote:

Hi Susheel,

On May 28, 2009, at 2:12 PM, Susheel Varma wrote:

HDF-Forum

I'm trying to query the existence of a particular compound dataset in an hdf5 file. I have tried using H5LTfind_dataset(hfile, "/sim/heart3d/sodium"), but it never returns a positive value for any combination(even for datasets I'm certain exists within the file). I need to know whether the dataset exists before I can issue a H5LTread_dataset(). Can anyone suggest the correct way to query the file for a dataset's existence?

  You should try using H5Lexists(), which will tell you if a link of a particular name exists in a group.

    Quincey

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.

Hi Susheel,

Yay! That worked. Now, according to the docs, I have to iterate and verify the groups and sub-groups manually. I suppose I could write a function to H5Literate through the links from the root group of the file, string comparing along the way, else it will become tedious quite quickly.

  If you are going to do something like this, you should look at H5Ovisit() and/or H5Lvisit() also.

  Quincey

···

On May 28, 2009, at 5:30 PM, Susheel Varma wrote:

So what does H5LTfind_dataset do really or differently?

Susheel

On 28 May 2009, at 20:55, Quincey Koziol wrote:

Hi Susheel,

On May 28, 2009, at 2:12 PM, Susheel Varma wrote:

HDF-Forum

I'm trying to query the existence of a particular compound dataset in an hdf5 file. I have tried using H5LTfind_dataset(hfile, "/sim/heart3d/sodium"), but it never returns a positive value for any combination(even for datasets I'm certain exists within the file). I need to know whether the dataset exists before I can issue a H5LTread_dataset(). Can anyone suggest the correct way to query the file for a dataset's existence?

  You should try using H5Lexists(), which will tell you if a link of a particular name exists in a group.

    Quincey

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.