Merge pull request #1787 from Unidata/NOAA-GSD-ejh_fix_redef

Noaa gsd ejh fix redef
This commit is contained in:
Ward Fisher 2020-07-09 17:17:19 -06:00 committed by GitHub
commit 675db5fa13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 2 deletions

View File

@ -8,6 +8,7 @@ This file contains a high-level description of this package's evolution. Release
## 4.8.0 - TBD ## 4.8.0 - TBD
* [Enhancement] Added new test for using compression with parallel I/O: nc_test4/tst_h_par_compress.c. See [https://github.com/Unidata/netcdf-c/pull/1784]. * [Enhancement] Added new test for using compression with parallel I/O: nc_test4/tst_h_par_compress.c. See [https://github.com/Unidata/netcdf-c/pull/1784].
* [Bug Fix] Don't return error for extra calls to nc_redef() for netCDF/HDF5 files, unless classic model is in use. See [https://github.com/Unidata/netcdf-c/issues/1779].
* [Bug Fix] Now allow szip to be used on variables with unlimited dimension [https://github.com/Unidata/netcdf-c/issues/1774]. * [Bug Fix] Now allow szip to be used on variables with unlimited dimension [https://github.com/Unidata/netcdf-c/issues/1774].
* [Enhancement] Add support for cloud storage using a variant of the Zarr storage format. Warning: this feature is highly experimental and is subject to rapid evolution [https://www.unidata.ucar.edu/blogs/developer/en/entry/overview-of-zarr-support-in]. * [Enhancement] Add support for cloud storage using a variant of the Zarr storage format. Warning: this feature is highly experimental and is subject to rapid evolution [https://www.unidata.ucar.edu/blogs/developer/en/entry/overview-of-zarr-support-in].
* [Bug Fix] Fix nccopy to properly set default chunking parameters when not otherwise specified. This can significantly improve performance in selected cases. Note that if seeing slow performance with nccopy, then, as a work-around, specifically set the chunking parameters. [https://github.com/Unidata/netcdf-c/issues/1763]. * [Bug Fix] Fix nccopy to properly set default chunking parameters when not otherwise specified. This can significantly improve performance in selected cases. Note that if seeing slow performance with nccopy, then, as a work-around, specifically set the chunking parameters. [https://github.com/Unidata/netcdf-c/issues/1763].

View File

@ -425,9 +425,10 @@ NC4_redef(int ncid)
return retval; return retval;
assert(nc4_info); assert(nc4_info);
/* If we're already in define mode, return an error. */ /* If we're already in define mode, return an error for classic
* files, or netCDF/HDF5 files when classic mode is in use. */
if (nc4_info->flags & NC_INDEF) if (nc4_info->flags & NC_INDEF)
return NC_EINDEFINE; return (nc4_info->cmode & NC_CLASSIC_MODEL) ? NC_EINDEFINE : NC_NOERR;
/* If the file is read-only, return an error. */ /* If the file is read-only, return an error. */
if (nc4_info->no_write) if (nc4_info->no_write)

View File

@ -497,6 +497,20 @@ test_redef(int format)
if (strcmp(var_name, REDEF_VAR2_NAME) || xtype_in != NC_BYTE || ndims != REDEF_NDIMS || if (strcmp(var_name, REDEF_VAR2_NAME) || xtype_in != NC_BYTE || ndims != REDEF_NDIMS ||
dimids_in[0] != dimids[0] || dimids_in[1] != dimids[1]) ERR; dimids_in[0] != dimids[0] || dimids_in[1] != dimids[1]) ERR;
/* Try enddef/redef. */
if (nc_enddef(ncid)) ERR;
if (nc_redef(ncid)) ERR;
/* NetCDF/HDF5 files ignore the repeated redef(). */
if (format != NC_FORMAT_NETCDF4)
{
if (nc_redef(ncid) != NC_EINDEFINE) ERR;
}
else
{
if (nc_redef(ncid)) ERR;
}
/* Close it up. */ /* Close it up. */
if (format != NC_FORMAT_NETCDF4) if (format != NC_FORMAT_NETCDF4)
if (nc_enddef(ncid)) ERR; if (nc_enddef(ncid)) ERR;