NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Thanks for the advice. The problem turned out to be a memory leak in my application. Once I fixed that, the error stopped. Robert Palumbo palumr@xxxxxxxxx On Jul 14, 2012 4:45 PM, "Dave Allured" <dave.allured@xxxxxxxx> wrote: > Rob, > > 1. Try renaming your variable "stat". In examples in the Netcdf > documentation, they use the var name "status". There may be a > conflict between the var name "stat" and a standard C library function > by the same name, from stat.h. > > 2. IIRC, zero is *never* a legal returned value for ncid, the Netcdf > file ID number. If you see zero, stop right there and find out what > else is wrong. > > 3. Ensure that ncid and status are both properly declared as type int > in your program. > > Just guessing here, but these are a few things I noticed. > > --Dave > > On Wed, Jul 11, 2012 at 7:29 PM, Robert Palumbo <palumr@xxxxxxxxx> wrote: > > Hey Everyone, > > > > I have an application that is writing consecutive NetCDF files > > sequentially (i.e. it's a single-threaded process). I am using NetCDF > > 4.1.3 on a Windows 7 OS with MSVC 10. Each NetCDF file is written > > using the following code: > > > > // Create NetCDF File > > stat = nc_create(filename, NC_NOCLOBBER, &ncid); > > check_err(stat,__LINE__,__FILE__); > > > > // Define data dimenssions > > stat=nc_def_dim(ncid,"Radial",alg_par->num_beam[0],&radial_dim); > > check_err(stat,__LINE__,__FILE__); > > > > ... > > > > >From there, I continue to define my data dimensions and input data > > before closing via 'nc_close()'. The process is then repeated a number > > of times. I implement check_err() via the suggested format: > > > > void check_err(const int stat, const int line, const char *file) > > { > > if(stat!=NC_NOERR) { > > fprintf(stderr,"line %d of %s: > %s\n",line,file,nc_strerror(stat)); > > fflush(stderr); > > exit(-1); > > } > > return; > > } > > > > I am getting an intermittent NC_EBADID error from the first > > nc_def_dim() call after the file is created. It always seems to happen > > when the NetCDF ID ('ncid' above) is set to zero (ncid == 0). > > > > Has anyone out there seen this? If the nc_create() call returns with > > NC_NOERR set, I'm confused as to why the first 'nc_def_dim' call fails > > with an error code. > > > > Any suggestions/help is greatly appreciated, > > > > Rob > > > > -- > > Robert A Palumbo > > Graduate Student > > University of Massachusetts - Amherst > > palumr@xxxxxxxxx > > > > _______________________________________________ > > netcdfgroup mailing list > > netcdfgroup@xxxxxxxxxxxxxxxx > > For list information or to unsubscribe, visit: > http://www.unidata.ucar.edu/mailing_lists/ >
netcdfgroup
archives: