Re: HDF5 - Group or Dataset? [message #45769 is a reply to message #45763] |
Wed, 05 October 2005 07:56  |
James Kuyper
Messages: 425 Registered: March 2000
|
Senior Member |
|
|
Peter Albert wrote:
> Hi everybody,
>
> I am again troubled by how IDL deals with HDF5. The problem is that I'd
> like to check whether a given name is the name of a dataset within an
> HDF5 file or the name of a group. Before IDL 6.1 a statement like
>
> n_members = h5g_get_nmembers(file_id, "/aaa/bbb")
>
> nicely returned 0 if /aaa/bbb was a dataset and the number of the
> group's members (> 0) otherwise.
What if it's a group that happens for some reason to have no members?
That's not a good way to test for distinguishing groups from
non-groups.
> Now, with IDL6.1, I get the error message
>
> % H5G_GET_NMEMBERS: unable to open group: (67108874, "/aaa/bbb") if I
> am actually looking at a dataset.
>
> Well, I looked through all those H5* routines in the IDL documentation,
> but did not find something like h5g_is_group. I would really like to
> solve this using error catching, so I would highly appreciate if
> someone has an idea.
Well, you can use H5G_OPEN(); if it succeeds, the name you provided is
the name of a group. Of course, the disadvantage is that you'll have to
call H5G_CLOSE().
|
|
|