NOTE: The netcdf-hdf
mailing list is no longer active. The list archives are made available for historical reasons.
You are doing the right thing. The junk at the end of the name is probably means the string isn't zero terminated. I don't know if you created it without the terminator, or what happened. If 'h5dump' shows the same junk, then the dataset was created with the wrong name. If 'h5dump' is OK, then something messed up the read. It's hard to say from what is included here. The iterator is looking at the dimensions attached to dataset did, dimension dim. The third parameter is the index for this dimension, e.g., if there is more than one scale attached to dimension 2. So the info is: did: the dataset being queried dim: the dimension (0, 1, 2, ...) idx: the scale for the dim On Sun, 10 Jul 2005, Ed Hartnett wrote: > > Howdy all! > > For the iterator through the dimension scales, the docs have this to > say: > > typedef herr_t (*H5DS_iterate_t)(hid_t did, unsigned dim, hid_t > dsid, void *visitor_data); > > "The operation receives the Dimension Scale dataset identifier, dsid, > and the pointer to the operator data passed in to H5DDiterate_scales, > visitor_data." > > What does parameter did hold? > > Also, when I try to use dsid to get the name of the dataset, I get > garbage: > > herr_t alien_visitor(hid_t did, unsigned dim, hid_t dsid, > void *visitor_data) > { > char name1[NC_MAX_NAME], name2[NC_MAX_NAME]; > > (*(hid_t *)visitor_data) = dsid; > if (H5Iget_name(did, name1, NC_MAX_NAME) < 0) ERR; > if (H5Iget_name(dsid, name2, NC_MAX_NAME) < 0) ERR; > /*printf("visiting did 0x%x dim %d dsid 0x%x name of did %s name of dsid > %s\n", > did, dim, dsid, name1, name2);*/ > printf("visiting did 0x%x dim %d dsid 0x%x name of did %s \n", > did, dim, dsid, name1); > printf("name of dsid: %s\n", name2); > return 0; > } > > Called like this: > > /* Go through all dimscales for this var and learn about them. */ > for (d = 0; d < ndims; d++) > if (H5DSiterate_scales(datasetid, d, NULL, alien_visitor, > &visitor_data) < 0) ERR; > > Yields this: > > visiting did 0x600000b dim 0 dsid 0x600000c name of did /simple_scales/var1 > :ú·(ùÔòÿ¿Àóÿ¿ > > > Does dsid not have a valid name? Or am I missing something? > > While in the visitor function, I need to know what dimscale I am > visiting. > > Thanks! > > Ed > -- Robert E. McGrath National Center for Supercomputing Applications University of Illinois, Urbana-Champaign Champaign, Illinois 61820 (217)-333-6549 mcgrath@xxxxxxxxxxxxx
netcdf-hdf
archives: