This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Hi Lynton, > I have a short programme that throws up an HDF5 error: NC_EHDFERR when > closing. It appears to be connected with defining a user-defined type: > Have you got any idea what the problem is? > > > The output of the code is: > 0 1 > 0 2 > 0 3 > 0 4 > 0 5 > 0 6 > 0 7 > 0 9 > 0 10 > -101 11 It looks to me as if you started to define a netCDF user-defined type named "ironBoundaryType", but didn't finish that definition. Then you tried to define netCDF variables of the incompletely defined type. It's a bug that the netCDF API lets you do this without returning an error until you close the file. I'm not sure whether there's also a corresponding bug in HDF5 that allows this. To complete the definition of the user-defined type, you need to fill out the type with repeated calls to nc_insert_compound(). Call the nc_insert_compound function once for each field (member) you wish to insert into the compound type. Don't define variables using a type until you finish defining the type. I'll enter a Jira ticket for this later and try to determine where the bug is, but it may have to wait until after we get the 4.3 release for the C library out ... --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: PFU-753378 Department: Support netCDF Priority: Normal Status: Closed