Only write the coord dimids if ndims >= 1

It looks like some vars have ndims==0 in which case the coord_dimids should not be written. Modify patch to catch those cases.
This commit is contained in:
Greg Sjaardema 2021-08-04 09:49:48 -06:00 committed by GitHub
parent 7b6f11c544
commit b9d192d0c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -992,8 +992,9 @@ var_create_dataset(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, nc_bool_t write_dimid
/* Always write the hidden coordinates attribute, which lists the
* dimids of this var. When present, this speeds opens. When no
* present, dimscale matching is used. */
if ((retval = write_coord_dimids(var)))
BAIL(retval);
if (var->ndims)
if ((retval = write_coord_dimids(var)))
BAIL(retval);
/* If this is a dimscale, mark it as such in the HDF5 file. Also
* find the dimension info and store the dataset id of the dimscale