[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 951210: netCDF irrational behavior?
- Subject: Re: 951210: netCDF irrational behavior?
- Date: Mon, 11 Dec 1995 11:00:50 -0700
Nan,
> thanks for your email. I tried using the workaround
> you suggested (in this case it was required because the
> new name was longer than the old) but it doesn't work
> for me. did you get it to work somehow? Maybe there
> is a little trick I am missing (?)
Here's what I did to verify the workaround:
First, I created a netCDF test file, by creating the file dbug.cdl:
--------------------- dbug.cdl ------------------------------------
netcdf dbug {
dimensions:
row = 2;
col = 3;
variables:
float a(row,col);
}
-------------------------------------------------------------------
and running
$ ncgen -n dbug.cdl
to create the file "dbug.nc".
Then I created the following C program to demonstrate the error:
---------------------- nan.c --------------------------------------
#include <netcdf.h>
main()
{
int ncid = ncopen("dbug.nc",NC_WRITE);
int did;
ncredef(ncid); /* enter define mode */
did = ncdimid(ncid, "row");
ncdimrename(ncid,did,"rows");
ncendef(ncid);
did = ncdimid(ncid, "rows");
ncdimrename(ncid,did,"row");
ncredef(ncid); /* enter define mode */
did = ncdimid(ncid, "row"); /* FAILS: ncdimid: dim "row" not found */
ncdimrename(ncid,did,"rows");
ncendef(ncid);
ncclose(ncid);
}
-------------------------------------------------------------------
When I compiled and linked with the latest beta release of netCDF 2.4, it
duplicated the problem you saw:
$ cc -g -I../libsrc nan.c -o nan -L../libsrc -lnetcdf -lnsl
$ ncgen -b dbug.cdl
$ ./nan
ncdimid: dim "row" not found
When I inserted calls to ncredef(ncid) and ncendef(id) around the middle
ncdimid and ncdimrename calls, as in:
ncredef(ncid); /* enter define mode */
did = ncdimid(ncid, "rows");
ncdimrename(ncid,did,"row");
ncendef(ncid);
and recreated the "dbug.nc" file before running this new test, everything
worked fine.
--Russ