Better implementation of the no dimscale attach option
@@ -1388,7 +1388,6 @@ attach_dimscales(NC_GRP_INFO_T *grp)
continue;
/* Find the scale for each dimension, if any, and attach it. */
- if (!grp->nc4_info->no_dimscale_attach) {
for (d = 0; d < var->ndims; d++)
{
/* Is there a dimscale for this dimension? */
@@ -1418,7 +1417,6 @@ attach_dimscales(NC_GRP_INFO_T *grp)
}
}
}
- }
return NC_NOERR;
}
@@ -1952,9 +1950,11 @@ nc4_rec_write_metadata(NC_GRP_INFO_T *grp, nc_bool_t bad_coord_order)
}
} /* end while */
- /* Attach dimscales to vars in this group. */
+ /* Attach dimscales to vars in this group. Unless directed not to. */
+ if (!grp->nc4_info->no_dimscale_attach) {
if ((retval = attach_dimscales(grp)))
return retval;
+ }
/* If there are any child groups, write their metadata. */
for (i = 0; i < ncindexsize(grp->children); i++)
