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.
> Date: Thu, 27 May 1999 18:06:23 +0300 > From: Bernard Nemry <address@hidden> > To: address@hidden > Subject: basic test > Organization: Laboratory for Planetary and Atmospheric Physics, Liege, Belgium Hi Bernard, > I am testing NetCDF library with samples found in the User's Guide for > Fortran > (June 1997). > > In a single FORTRAN source, I use functions NF_CREATE, then NF_OPEN. > > NF_CREATE('foo.nc',NF_CLOBBER,ncid) creates a file 'foo.nc', > (status = 0, ncid = 3) > but NF_OPEN('foo.nc',NF_WRITE,ncid) gives > status = -51 (Not a netCDF file) and stops the run. This might have worked if you had closed the file with NF_CLOSE after creating it with NF_CREATE, but that's probably not what you intended. You should usually use either NF_CREATE or NF_OPEN, not both. NF_CREATE is intended for when you want to create a new netCDF file, and NF_OPEN is intended for when you want to open an existing netCDF file that was previously created. For an example of the sequence of calls used to create a netCDF dataset, see "4.1 Creating a NetCDF Dataset" in the Fortran User's Guide: http://www.unidata.ucar.edu/packages/netcdf/guidef/guidef-9.html#HEADING9-0 For examples of opening an existing netCDF dataset, see the subsequent sections "4.2 Reading a NetCDF Dataset with Known Names" and "4.3 Reading a netCDF Dataset with Unknown Names". Also, feel free to direct questions like this to "address@hidden" rather than the mailing list "address@hidden". Despite the somewhat misleading name, the latter is actually a mailing list of netCDF users. --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu