Re: No HDF5 info type functions? [message #44602] |
Tue, 05 July 2005 10:30  |
James Kuyper
Messages: 425 Registered: March 2000
|
Senior Member |
|
|
ellips@yahoo.com wrote:
> I'm trying to find the names and numbers of HDF5 groups/datasets
> in IDL. This was done for HDF 4 files with functions like
> hdf_sd_fileinfo. I don't see any equivalent types of functions
> for the HDF5 interface. It seems you need to know the group/dataset
> names before you can access them. I want to be very general and
> rely on the file contents to tell me what's in the file.
>
> I'd like to query the HDF5 file for the number of top level groups,
> loop through them to get their names and go on down the tree.
> How do you get the name of the top level group?
Note: everything I say below is based upon reading the built-in IDL
documentation and HDF5 documentation from
<http://hdf.ncsa.uiuc.edu/HDF5/doc/>. None of it represents actual
experience with using those functions, as I have no HDF5 files to test
with, nor time to perform the tests.
HDF5 groups have a naming structure similar to that of UNIX file
systems. Therefore, the top level group is always named '/'. All of the
other group names can be obtained from that one, by iterating over the
group members, and if a group member is itself a group, recursively
iterating over it's members.
Once you've opened a given group, the number of members of that group
can be found by using H5G_Get_Nmembers(). That will allow you to
iterate over the members by number to get their names by calling
H5G_Get_Member_Name(). Use the member name to determine the object type
with H5G_Get_Objinfo(). If the object type is itself a group,
recursively iterate over the members of that group. If the object type
is a dataset, Call H5D_Get_Type() to determine it's data type.
> The IDL docs show many functions taking loc_id to be a file OR group id.
When providing a file ID, the group name must be an absolute name, such
as /Data/Cdata. However, if you provide a group ID, you can use a name
relative to that group. For instance, you can open /Data/Cdata using
the groupID for "/Data", and a relative group name of "Cdata".
|
|
|
Re: No HDF5 info type functions? [message #44695 is a reply to message #44602] |
Wed, 06 July 2005 07:09  |
ellips
Messages: 4 Registered: November 2003
|
Junior Member |
|
|
Thanks. Knowing that the top level group is '/' does the trick.
I wonder if that will always be true and you can't force the
top level group to be something else.
The output of H5_PARSE was confusing since it gave the
_NAME of the top level group the path/filename of the file.
I looked at the source and they do this explicitly.
Anyway, thanks for the help.
|
|
|