This commit adds three new tests:
- a test documenting the limitation originally reported in #350 (in
general modifying an attribute about 2^16 times makes it impossible
to modify this file in ways requiring nc_redef() and nc_enddef() calls).
- a test ensuring that a scalar attribute can be modified 2^16 times
as long as its type and size remain the same
- a test ensuring that a text attribute can be modified 2^16 times as
long as its size remains the same
This version uses the nc_redef(), nc_put_att_...(), nc_enddef()
sequence. One could also use nc_open(), nc_put_att_...(), nc_close()
but that would make these tests significantly slower.
1) We have to use H5Tequal() to compare HDF5 type IDs.
2) When checking if we can re-use an NC_CHAR attribute it is enough to
compare data types (H5Tequal() takes care of the size comparison).
3) This commit adds missing code (reuse_att was set but not used).
Now an attribute in a NetCDF-4 file can be modified as many times as
necessary, as long its type and length remain the same.
Modifications changing either type or length of an attribute require
deleting and re-creating an attribute which increments the attribute
order creation index. Once this index reaches 65535 all attribute
modifications (for a particular group or variable) will fail.
For reference:
Issue 350 title: NetCDF-4 limits the number of times an attribute can
be modified
Pull request 1119 title: Fix checking for HDF5 max dims, no longer
re-create atts if not needed, confirm behavior for HDF5 cyclical
files, allow user to set mpiexec
re: https://github.com/Unidata/netcdf-c/issues/1502
If you plan to use any of the netcdf_XXX.h files, then it it is assumed
that you first include netcdf.h, followed by any netcdf_XXX.h files
you need. The EXTERNL (and other things) are defined in netcdf.h
so they should be available for use by the netcdf_XXX.h files.
This PR ensures that the above assumption is true. It also adds
some comments to that effect to the start of the netcdf_xxx.h files.