Hi,
I'm trying to write to a NetCDF file and an HDF5 file at the same time. When I
call nc_close() the HDF5 file identifier gets corrupted:
#include <netcdf.h>
#include <hdf5.h>
#define H5_FILE "test.h5"
#define NC_FILE "test.nc"
int main (void)
{
hid_t h5file;
int ncid;
h5file = H5Fcreate(H5_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
nc_create (NC_FILE, NC_CLOBBER, &ncid);
nc_close (ncid);
/** Code to write data to the HDF5 file removed for simplicity **/
H5Fclose (h5file);
return 0;
}
Using NetCDF 4.1.1 and HDF5 1.8.5, I get the following error when calling
H5Fclose and the resulting HDF file is empty:
HDF5-DIAG: Error detected in HDF5 (1.8.5) thread 0:
#000: H5F.c line 1943 in H5Fclose(): invalid file identifier
major: Invalid arguments to routine
minor: Inappropriate type
Calling H5Fclose() _before_ nc_close() makes the problem go away. The problem
also does not occur when linking against NetCDF 3.6.3. Is this possibly a bug
in nc_close()?
Any help appreciated.
/oliver