This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
> Full Name: Liancong Luo > Email Address: address@hidden > Organization: Waikato University > Package Version: > Operating System: > Hardware: > Description of problem: > > I opened the netcdf file, closed it and then problem with reopen the > same nc file. However, if I remove the following code in "nc_test.f90", > it is fine for reopening. > > status=nf_inq_var(ncid,varid,varnam(i),vartyp(i),nvdims(i),vdims(I),nvatts(I)) > > but I need this code for getting the variable names. Could u please > tell me what the problem with reopening the nc file is? > > Thanks, > > Liancong > > I suspect you don't really want arrays for the vartyp, nvdims, and nvatts parameters. The only arrays are the name (character array) and the vdims array (one element for each dimension of the variable - ex. 3 for a 3D variable). The access violation you get is because you are trying to write somewhere in memory that you do not have legal access to. (Shame on you! ;-) This could also be caused by your vdims array being too small (less than the dimensionality of the data). Please let me know if this doesn't help. Thanks! Ed Ticket Details =================== Ticket ID: KQW-622959 Department: Support netCDF Priority: Normal Status: Closed