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.
> NetCDF Gurus, > > How do I specify the default behavior to create NetCDF-4 files in Fortran 90? > The documentation is a bit confusing. > > We've got an existing F90 Fortran code (ROMS) that uses NetCDF > extensively, with lots of calls to "nf90_create" sprinkled through the > code. I can set the flag in each of these calls to write NetCDF-4, > but on this page: > http://www.unidata.ucar.edu/software/netcdf/docs/netcdf/Which-Format.html > it mentions that "It is also possible to change the default creation > format, to convert a large body of code without changing every create > call, and mentions the NF_SET_DEFAULT_FORMAT function". The link to > that function: > http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-f77/NF_005fSET_005fDEFAULT_005fFORMAT.html > says that the usage is: > > INTEGER FUNCTION NF_SET_DEFAULT_FORMAT(INTEGER FORMAT, INTEGER OLD_FORMT) > > FORMAT Either nf_format_64bit or nf_format_classic. > OLD_FORMAT The default format at the time the function is called is > returned here. > > -Rich > -- > Dr. Richard P. Signell (508) 457-2229 > USGS, 384 Woods Hole Rd. > Woods Hole, MA 02543-1598 > > Howdy Rich! That's a bug in our documentation, which I have fixed. Thanks for pointing it out. To answer your question, you can use nf_set_nf_format_netcdf4 or nf_format_netcdf4_classic to set the default format. (You probably want nf_format_netcdf4_classic). Please let me know if this doesn't help. Thanks, Ed Ticket Details =================== Ticket ID: MXU-426658 Department: Support netCDF Priority: Normal Status: Closed