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

  • To: Dmitry Voytsekhovskiy <dvoits@xxxxxxxxx>
  • Subject: Re: [netcdfgroup] Error when defining variable and then dimension with same name
  • From: Ed Hartnett <ed@xxxxxxxxxxxxxxxx>
  • Date: Thu, 13 Oct 2011 07:11:42 -0600
Dmitry Voytsekhovskiy <dvoits@xxxxxxxxx> writes:

> 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("[1]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.

What are you using for the dimid of the variable?

Thanks,

Ed
-- 
Ed Hartnett  -- ed@xxxxxxxxxxxxxxxx



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