The variable can be scalar (i.e. dimids argument is empty as in the
example), or depend on any dimension defined before nc_def_var.
The result is same in either case.
On Thu, Oct 13, 2011 at 5:11 PM, Ed Hartnett <ed@xxxxxxxxxxxxxxxx> wrote:
> 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
>