Quincey,
Naturally you're more familiar with the HDF5 interface than I am. I've
read your documents and just have a couple of comments/questions:
1 - I gather you are using a time-stamp instead of an index. Have you
considered what will happen if two different machines add a
dataset/variable to the same netcdf-4 file, and their clocks are
wrong? Or lets say I change the time on my machine and then open the
file and add a variable. Did I just break the creation order?
2 - I will never need to go backwards through the list. When I read an
unknown file, I read in all metadata in one pass into internal
netcdf-4 structs. So I only need to go through each group in forward
order.
3 - As I understand it, this applies on a group by group basis. That
is, I will be able to open a group, and cycle through it's objects in
their creation order. Then I can open another group and find *its*
objects, in creation order. Is that correct?
4 - I don't use H5GIterate at all, so it doesn't have to be modified
for me. Below I show the code I use. It's in nc4hdf.c, as are most of
the HDF5 calls in netcdf-4. (Pertinent code is included below).
5 - From the "group access" property list part, I'm getting the idea
that I can write a HDF5 file with a bunch of datasets, then open it,
and by opening the group with the proper "group access" property, I
can get the objects in creation order. In other words, I don't have to
take any special effort in creating the HDF5 file, the creation order
is stored always. Is that correct?
6 - Here's the code I have now. As I understand your design, I will
just have to open the group with the "group access" property list and
this code will work fine, because H5Gget_objtype_by_idx will return
objects in creation order.
if ((grp->hdf_grpid = H5Gopen(locid, grp->name)) < 0)
BAIL(NC_EHDFERR);
}
/* Find the variables. Read their metadata and attributes. */
if (H5Gget_num_objs(grp->hdf_grpid, &num_obj) < 0)
BAIL(NC_EVARMETA);
for (i=0; i<num_obj; i++)
{
/* Get the type (i.e. group, dataset, etc.), and the name of the object.
*/
if ((obj_type = H5Gget_objtype_by_idx(grp->hdf_grpid, i)) < 0)
BAIL(NC_EHDFERR);
if (H5Gget_objname_by_idx(grp->hdf_grpid, i, obj_name, NC_MAX_HDF5_NAME)
< 0)
BAIL(NC_EVARMETA);
LOG((4, "Encountered: HDF5 object obj_type %d obj_name %s", obj_type,
obj_name));
/* Deal with groups and datasets. */
if (obj_type == H5G_GROUP)
{
7 - What about attributes? Can I get them by creation order too? You
make no mention of H5Aopen_idx, but that's what I use. Here's the code
I use to read atts in a group:
num_obj = H5Aget_num_attrs(grp->hdf_grpid);
for (i = 0; i < num_obj; i++)
{
if (attid > 0) H5Aclose(attid);
if ((attid = H5Aopen_idx(grp->hdf_grpid, (unsigned int)i)) < 0)
BAIL(NC_EATTMETA);
if (H5Aget_name(attid, NC_MAX_NAME + 1, obj_name) < 0)
BAIL(NC_EATTMETA);
LOG((4, "reading attribute of _netCDF group, named %s", obj_name));
Thanks,
Ed
--
Ed Hartnett -- ed@xxxxxxxxxxxxxxxx