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.
> > Hi, your NetCDF Fortran 90 Interface looks like it might be very useful > to us, and we'd like to incorporate it into our code, but I'm a little > bit concerned about the possibility of Fortran unit number conflicts. > I assume that, on opening a new NetCDF file, a Fortran unit number is > assigned, but you don't appear to have any control over which unit > number that is. Since we also do non-NetCDF I/O in our code then this > seems to open the possibility that a NetCDF will choose a unit number > which will later be used (or perhaps is already being used) by another > part of the code, leading to a conflict. Is this indeed a possibility, > or am I underestimating the cleverness of your code? If it is a > possibility then is their a way around it, or of mitigating the risk? > Can we at least know what unit number has been chosen for the NetCDF > file? > > Any advice greatly appreciated, > > Luke Jones. > > -- > Dr Luke Jones Mesoscale Development Scientist > Met Office FitzRoy Road Exeter EX1 3PB United Kingdom > Tel: +44 (0)1392 884109 Fax: +44 (0)1392 885681 > E-mail: address@hidden http://www.metoffice.com > > Howdy Luke Jones! NetCDF files, even when accessed with the F90 API, are actually all opened and manipulated in C code, not in Fortran code. So no Fortran unit numbers are used. The netCDF F90 functions call netCDF F77 functions. The netCDF F77 functions call netCDF C functions. The C functions are where all the file opens and closes take place. So Robert has assumed his proper avuncular relationship! Keep on netCDFing! Ed Hartnett Ticket Details =================== Ticket ID: WVL-288144 Department: Support netCDF Priority: Normal Status: Closed