[netcdfgroup] Error when defining variable and then dimension with same name

Hello,

I get an HDF Layer error (-101) when I define a dimension with same name as
a name of already defined variable:


int ncid, dtime, vtime;
int res = nc_create("test.nc", NC_NETCDF4, out ncid);
Handle(res);

res = nc_def_var(ncid, "time", NC_DOUBLE, new int[] {  }, out vtime);
Handle(res);
res = nc_def_dim(ncid, "time", 10, out dtime);
Handle(res);

res = nc_close(ncid);
Handle(res); // error: res == -101


In the opposite order it works; also it works in any order for different
names.


Though such use case looks weird, it is still possible for an inexperienced
user to write similar code.


Regards,
Dmitry.
  • 2011 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: