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.
> Organization: NOAA/FSL > Keywords: 199402241656.AA21418 Hi Barry, > I just discovered something very interesting in the FORTRAN interface > with the netCDF software. It is something I should have noticed a long > time ago. When you make a call to NCOPN (to open a netCDF file), > if the file does not exist, the calling FORTRAN program bombs, i.e., > the program terminates with out allowing transfer control to > somewhere else. This is a HUGE problem if you want to run a job > "operationally", because the process manager sftware cannot have > a job bombing without transfer of control. In addition, this does not > allow for the program to say, search somewhere else, for a file > to open. In VMS this is no problem because one would: > > open(unit=10,file=input_file,status=old,err=100) > > If the file is not found, transfer of control sends you to line 100 > and you continue. Why then does the netCDF FORTRAN interface have > an error code returned, but you can't do anything with it since the > calling program crashes? Are we using the software incorrectly? This is not really a problem. It's covered in the section of the NetCDF User's Guide on Error Handling at the end of Chapter 4. There it says: In the FORTRAN interface, the error options described above can be accessed by using the routines NCPOPT and NCGOPT. The default error- handling behavior is equivalent to the statement CALL NCPOPT(NCVERBOS+NCFATAL) where the values of NCVERBOS and NCFATAL are pre-defined constants from the FORTRAN include file `netcdf.inc'. If you want error messages, but do not wish errors to be fatal, turn off the fatal error flag with: CALL NCPOPT(NCVERBOS) If you want neither error messages nor fatal errors, turn off both flags with: CALL NCPOPT(0) To get the current value of the error options, use: CALL NCGOPT(NCOPTS) > Another problem. When I compile a FORTRAN program using the netCDF > software I need to have an "include netcdf.inc" statement at the top of > the code. Anyway, when I compile without the -g option (in unix) > it works just fine. However, if I compile the code with the -g option > (f77 mycode.f -g I get an error that says something like: > > no triple block > > referring to the netcdf.inc statement. Any clue of what this is all > about. Typically the "-g" option goes before the source file, but i've never seen such an error message. It sounds like a compiler problem. What hardware, operating system, and compiler produces this error? > Oh, somehow I remember that perhaps you aren't the person > to contact about this, so if you can, please remind me where I can send > these questions to or forward for me please. Thanks! If you send netCDF questions to address@hidden, they will get answered even if I am on vacation or out of town. __________________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden P.O. Box 3000 (303)497-8645 Boulder, Colorado 80307-3000