How to find path of committed datatype

Hi,

Consider I have a dataset that uses a committed (named) datatype, what
is the most efficient way to find the path of this datatype in an HDF5
file? Looking at the the API calls in H5T, the only way I can see is to
scan all groups for committed datasets and calling H5Tequal() on each of
them to find out whether this one equals the datatype of the dataset.
The scanning might be very inefficient if the HDF5 file contains many
groups with many members. Is there a more efficient way of doing that?
How does h5dump get the information that it prints in the "DATATYPE"
line for a dataset?

Bernd

Hi,

  h5dump dumps just everything, so it remembers how it found each component.

Scanning an entire file for a particular information, whether it be a dataset
or a named datatype, is of course inefficient.

Do you have any control about how the file is written or any knowledge
about the file layout that may help you to predict in advance where
the named data type might be? What are you planning to do with the
named data type?

    Werner

···

On Wed, 13 Apr 2011 07:40:59 -0500, Bernd Rinn <bernd.rinn@bsse.ethz.ch> wrote:

Hi,

Consider I have a dataset that uses a committed (named) datatype, what
is the most efficient way to find the path of this datatype in an HDF5
file? Looking at the the API calls in H5T, the only way I can see is to
scan all groups for committed datasets and calling H5Tequal() on each of
them to find out whether this one equals the datatype of the dataset.
The scanning might be very inefficient if the HDF5 file contains many
groups with many members. Is there a more efficient way of doing that?
How does h5dump get the information that it prints in the "DATATYPE"
line for a dataset?

Bernd

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

--
___________________________________________________________________________
Dr. Werner Benger Visualization Research
Laboratory for Creative Arts and Technology (LCAT)
Center for Computation & Technology at Louisiana State University (CCT/LSU)
211 Johnston Hall, Baton Rouge, Louisiana 70803
Tel.: +1 225 578 4809 Fax.: +1 225 578-5362

Try the following:
1) Call H5Tcommitted() to check is the dataype is a named datatype
2) Call H5Iget_name() to get a full path to the named dataype.

···

On 4/13/2011 7:40 AM, Bernd Rinn wrote:

Hi,

Consider I have a dataset that uses a committed (named) datatype, what
is the most efficient way to find the path of this datatype in an HDF5
file? Looking at the the API calls in H5T, the only way I can see is to
scan all groups for committed datasets and calling H5Tequal() on each of
them to find out whether this one equals the datatype of the dataset.
The scanning might be very inefficient if the HDF5 file contains many
groups with many members. Is there a more efficient way of doing that?
How does h5dump get the information that it prints in the "DATATYPE"
line for a dataset?

Bernd

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Hi Werner,

Hi,

h5dump dumps just everything, so it remembers how it found each component.

Scanning an entire file for a particular information, whether it be a
dataset
or a named datatype, is of course inefficient.

Do you have any control about how the file is written or any knowledge
about the file layout that may help you to predict in advance where
the named data type might be? What are you planning to do with the
named data type?

I plan to put additional information about e.g. a compound datatype into
an attribute attached to the datatype. This information will give
additional information about the members. It is an option to put all
datatypes into one directory and thus reduce the number of entries that
I would have to scan to find the right committed datatype. That,
however, makes the solution specific to the group layout chosen, which I
want to do only if there is no better way of getting this information.

Best,

Bernd

···

On 11-04-13 16:40, Werner Benger wrote:

On Wed, 13 Apr 2011 07:40:59 -0500, Bernd Rinn <bernd.rinn@bsse.ethz.ch> > wrote:

Hi,

Consider I have a dataset that uses a committed (named) datatype, what
is the most efficient way to find the path of this datatype in an HDF5
file? Looking at the the API calls in H5T, the only way I can see is to
scan all groups for committed datasets and calling H5Tequal() on each of
them to find out whether this one equals the datatype of the dataset.
The scanning might be very inefficient if the HDF5 file contains many
groups with many members. Is there a more efficient way of doing that?
How does h5dump get the information that it prints in the "DATATYPE"
line for a dataset?

Bernd

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Thanks Peter,

That does the trick!

Bernd

···

On 11-04-13 16:59, Peter Cao wrote:

Try the following:
1) Call H5Tcommitted() to check is the dataype is a named datatype
2) Call H5Iget_name() to get a full path to the named dataype.

On 4/13/2011 7:40 AM, Bernd Rinn wrote:

Hi,

Consider I have a dataset that uses a committed (named) datatype, what
is the most efficient way to find the path of this datatype in an HDF5
file? Looking at the the API calls in H5T, the only way I can see is to
scan all groups for committed datasets and calling H5Tequal() on each of
them to find out whether this one equals the datatype of the dataset.
The scanning might be very inefficient if the HDF5 file contains many
groups with many members. Is there a more efficient way of doing that?
How does h5dump get the information that it prints in the "DATATYPE"
line for a dataset?

Bernd

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Hi Bernd,

Hi Werner,

Hi,

h5dump dumps just everything, so it remembers how it found each component.

Scanning an entire file for a particular information, whether it be a
dataset
or a named datatype, is of course inefficient.

Do you have any control about how the file is written or any knowledge
about the file layout that may help you to predict in advance where
the named data type might be? What are you planning to do with the
named data type?

I plan to put additional information about e.g. a compound datatype into
an attribute attached to the datatype. This information will give
additional information about the members. It is an option to put all
datatypes into one directory and thus reduce the number of entries that
I would have to scan to find the right committed datatype. That,
however, makes the solution specific to the group layout chosen, which I
want to do only if there is no better way of getting this information.

Do you have the respective dataset for which the named datatype is used?
If so, you could just use that one's datatype to attach another attribute
to it without needing to know where exactly the named datatype is stored in
the file. This won't work if the datatype of an dataset is unnamed,
but you can find that out as well.

Would this do?

  Werner

···

On Wed, 13 Apr 2011 09:48:04 -0500, Bernd Rinn <bernd.rinn@bsse.ethz.ch> wrote:

On 11-04-13 16:40, Werner Benger wrote:

Best,

Bernd

On Wed, 13 Apr 2011 07:40:59 -0500, Bernd Rinn <bernd.rinn@bsse.ethz.ch> >> wrote:

Hi,

Consider I have a dataset that uses a committed (named) datatype, what
is the most efficient way to find the path of this datatype in an HDF5
file? Looking at the the API calls in H5T, the only way I can see is to
scan all groups for committed datasets and calling H5Tequal() on each of
them to find out whether this one equals the datatype of the dataset.
The scanning might be very inefficient if the HDF5 file contains many
groups with many members. Is there a more efficient way of doing that?
How does h5dump get the information that it prints in the "DATATYPE"
line for a dataset?

Bernd

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

--
___________________________________________________________________________
Dr. Werner Benger Visualization Research
Laboratory for Creative Arts and Technology (LCAT)
Center for Computation & Technology at Louisiana State University (CCT/LSU)
211 Johnston Hall, Baton Rouge, Louisiana 70803
Tel.: +1 225 578 4809 Fax.: +1 225 578-5362