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.
Reggie, A "permission denied" error message indicates that the operating system won't allow your program to create the associated file. This probably has nothing to do with the netCDF library. Reasons for denying this permission include the following: 1. The file name is invalid. Put some quotes around the filename to see if it contains any embedded, illegal characters. 2. The directory in not writable by you Try creating a file in the directory by another means. 3. The disk is remotely-mounted read-only. Try creating a file in the directory by another means. 4. The disk is full. Try creating a file in the directory by another means. 5. The file already exists but cannot be deleted as the semantics of "nf_clobber" demand. See if the file exists and check its permissions against those of your program. I do not see how changing the type of the filename-containing variable could change the behavior of the program. Regards, Steve Emmerson <http://www.unidata.ucar.edu> > From: "Reggie Chang" <address@hidden> > Subject: question related to nf_create > Organization: ZONA Technology > Keywords: 200107250025.f6P0P8106981 netCDF nf_create > > Hi, > > Recently I encountered a problem regarding netcdf. > I'll append part of the source code and the output at > the end of this email. Basically the error message > indicates "Permission denied" when I attempt to > use nf_create. (I need to have a name passed into > the subroutine as the file name to be created.) > > What puzzles me is that I could do similar thing > while specifying fixed length (say character*7 as > argument) in the calling subroutine. In another > word, the subroutine which calls cdfsav still passes > a CHARACTER*(*) into cdfsav. Is this an issue? > > Your information is very much appreciated. > > Reggie Chang > > > > > subroutine cdfsav(filenm) > !cdfsav creates the data file to be saved later > !it is called right after original data file is opened > include 'netcdf.inc' > common /netcdf/ ncid=20 > common /unlimited/ tim_rd > CHARACTER*(*) FILENM =20 > > integer tim_rd > > !create a database file > !nstatus =3D nf_create('test_aic.nc', nf_clobber, ncid) > print*, 'test print 000' > print*, 'filenm is ', filenm > > nstatus =3D nf_create(filenm, nf_clobber, ncid) > if (nstatus .ne. nf_noerr) call handle_err(nstatus) > > print*, 'test print 000-1' > =20 > end > > > output: > test print 000 > filenm is HA145FB_AIC7 =20 > status =3D 13 > Permission denied =20