-
Notifications
You must be signed in to change notification settings - Fork 286
Open
Description
I am creating and immediately closing a netcdf file with NC_FORMAT_CDF5/NC_FORMAT_64BIT_DATA (without creating any dimensions, variables, attributes, etc.). When I query the format, it returns 1 (NC_FORMAT_CLASSIC). Is this expected?
This is on a mac (Apple Silicon). NetCDF version is 4.9.3 and the build log shows that CDF5 is enabled:
# Features
--------
Benchmarks: no
NetCDF-2 API: yes
HDF4 Support: no
HDF5 Support: yes
CDF5 Support: yes
NC-4 Parallel Support: no
PnetCDF Support: no
Here is the reproduction code:
#include <iostream>
#include <netcdf.h>
void checkErrorCode(int status, const char* message){
if (status != NC_NOERR){
std::cout << "Error code: " << status << " from " << message << std::endl;
std::cout << nc_strerror(status) << std::endl << std::endl;
}
}
int main()
{
int ncid;
int retval;
std::cout << "NC_FORMAT_64BIT_DATA: " << NC_FORMAT_64BIT_DATA << std::endl;
retval = nc_create("myfile.nc", NC_FORMAT_64BIT_DATA, &ncid);
checkErrorCode(retval, "nc_create");
int format;
retval = nc_inq_format(ncid, &format);
checkErrorCode(retval, "nc_inq_format");
std::cout << "format: " << format << std::endl;
retval = nc_close(ncid);
checkErrorCode(retval, "nc_close");
}
It produces the following output:
$ ./a.out
NC_FORMAT_64BIT_DATA: 5
format: 1
Metadata
Metadata
Assignees
Labels
No labels