diff --git a/include/nc4internal.h b/include/nc4internal.h index 0fc81fa21..afcffa3d3 100644 --- a/include/nc4internal.h +++ b/include/nc4internal.h @@ -118,8 +118,6 @@ typedef struct NC_DIM_INFO nc_bool_t extended; /* True if the dimension needs to be extended */ nc_bool_t too_long; /* True if len is too big to fit in local size_t. */ void *format_dim_info; /* Pointer to format-specific dim info. */ - /* hid_t hdf_dimscaleid; /\* Non-zero if a DIM_WITHOUT_VARIABLE dataset is in use (no coord var). *\/ */ - HDF5_OBJID_T hdf5_objid; struct NC_VAR_INFO *coord_var; /* The coord var, if it exists. */ } NC_DIM_INFO_T; diff --git a/libhdf5/hdf5open.c b/libhdf5/hdf5open.c index b5dc3aed0..7ba05a850 100644 --- a/libhdf5/hdf5open.c +++ b/libhdf5/hdf5open.c @@ -1752,10 +1752,6 @@ read_scale(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, new_hdf5_dim->hdf5_objid.fileno[1] = statbuf->fileno[1]; new_hdf5_dim->hdf5_objid.objno[0] = statbuf->objno[0]; new_hdf5_dim->hdf5_objid.objno[1] = statbuf->objno[1]; - new_dim->hdf5_objid.fileno[0] = statbuf->fileno[0]; - new_dim->hdf5_objid.fileno[1] = statbuf->fileno[1]; - new_dim->hdf5_objid.objno[0] = statbuf->objno[0]; - new_dim->hdf5_objid.objno[1] = statbuf->objno[1]; /* If the dimscale has an unlimited dimension, then this dimension * is unlimited. */ diff --git a/libhdf5/nc4hdf.c b/libhdf5/nc4hdf.c index 5be87398d..f0e5ba032 100644 --- a/libhdf5/nc4hdf.c +++ b/libhdf5/nc4hdf.c @@ -2972,28 +2972,29 @@ nc4_rec_match_dimscales(NC_GRP_INFO_T *grp) for (d = 0; d < var->ndims; d++) { nc_bool_t finished = NC_FALSE; - LOG((5, "%s: var %s has dimscale info...", __func__, var->hdr.name)); - /* Look at all the dims in this group to see if they - * match. */ + + /* Check this and parent groups. */ for (g = grp; g && !finished; g = g->parent) { + /* Check all dims in this group. */ for (j = 0; j < ncindexsize(g->dim); j++) { + /* Get the HDF5 specific dim info. */ NC_HDF5_DIM_INFO_T *hdf5_dim; dim = (NC_DIM_INFO_T *)ncindexith(g->dim, j); assert(dim && dim->format_dim_info); hdf5_dim = (NC_HDF5_DIM_INFO_T *)dim->format_dim_info; - /* Check for exact match to find identical - * objects in HDF5 file. */ - if (var->dimscale_hdf5_objids[d].fileno[0] == dim->hdf5_objid.fileno[0] && - var->dimscale_hdf5_objids[d].objno[0] == dim->hdf5_objid.objno[0] && - var->dimscale_hdf5_objids[d].fileno[1] == dim->hdf5_objid.fileno[1] && - var->dimscale_hdf5_objids[d].objno[1] == dim->hdf5_objid.objno[1]) + /* Check for exact match of fileno/objid arrays + * to find identical objects in HDF5 file. */ + if (var->dimscale_hdf5_objids[d].fileno[0] == hdf5_dim->hdf5_objid.fileno[0] && + var->dimscale_hdf5_objids[d].objno[0] == hdf5_dim->hdf5_objid.objno[0] && + var->dimscale_hdf5_objids[d].fileno[1] == hdf5_dim->hdf5_objid.fileno[1] && + var->dimscale_hdf5_objids[d].objno[1] == hdf5_dim->hdf5_objid.objno[1]) { - LOG((4, "%s: for dimension %d, found dim %s", - __func__, d, dim->hdr.name)); + LOG((4, "%s: for dimension %d, found dim %s", __func__, + d, dim->hdr.name)); var->dimids[d] = dim->hdr.id; var->dim[d] = dim; finished = NC_TRUE; @@ -3001,7 +3002,8 @@ nc4_rec_match_dimscales(NC_GRP_INFO_T *grp) } } /* next dim */ } /* next grp */ - LOG((5, "%s: dimid for this dimscale is %d", __func__, var->type_info->hdr.id)); + LOG((5, "%s: dimid for this dimscale is %d", __func__, + var->type_info->hdr.id)); } /* next var->dim */ } /* No dimscales for this var! Invent phony dimensions. */