netcdf-c icon indicating copy to clipboard operation
netcdf-c copied to clipboard

NC_CLASSIC_MODEL and nc_enddef

Open wkliao opened this issue 2 years ago • 2 comments

When using flag NC_CLASSIC_MODEL to create an HDF5-based file, is calling nc_enddef() required before the first put/get var call?

In the NetCDF-C document, nc_enddef has the following statement, which implies it is not required.

It's not necessary to call nc_enddef() for netCDF-4 files.

wkliao avatar Aug 26 '22 21:08 wkliao

Yes it is necessary when NC_CLASSIC_MODEL is used.

It is not necessary for netCDF-4 files which were created without NC_CLASSIC_MODEL.

edwardhartnett avatar Aug 27 '22 01:08 edwardhartnett

I am interested in learning the reason of why it is required. Could you please explain?

Also, look like the nc_enddef document can use a clarification.

wkliao avatar Aug 27 '22 05:08 wkliao