NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
> Is there a way for an application linked to a netcdf library to > determine whether the netcdf-4 capabilities are present in the library? Yes, but it's not exactly elegant :-) #include <netcdf.h> /* Returns 1 if linked to library with netCDF-4 features enabled, otherwise 0 */ int is_netcdf4(void) { int ncid; int stat = nc_create("/tmp/tmp.nc", NC_NETCDF4, &ncid); if(stat == NC_ENOTNC) return 0; return 1; } > I have an application that I want to normally write a classic netcdf-3 > file, but if the netcdf library was compiled with the netcdf-4 option > enabled, it should create a netcdf-4 file. It looks like the netcdf.h > file is the same for both options and I don't see any api function that > would give the information. We'll consider adding such a function in addition to the current nc_inq_libvers() function that returns a string for which version of the library source was used to build the library, but doesn't specify with which features the library was built. --Russ
netcdfgroup
archives: