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.
------- Forwarded Message Date: Fri, 16 Nov 2001 15:44:35 -0700 From: Russ Rew <address@hidden> To: Qiaozhen Mu <address@hidden> >To: address@hidden, >To: address@hidden >From: Qiaozhen Mu <address@hidden> >Organization: UCAR/Unidata >Keywords: 200111160402.fAG42HN12679 Hi Qiaozhen, > I want to use fortran 77 programs to read netcdf files and to write netcdf > files, how can I get them? I don't know whether you have such programs to > provide to the users. Could you please give me some? You can generate a Fortran program to write a netCDF file using ncgen -f example.cdl > example.f where "example.cdl" is an ASCII "CDL" file that describes the data dimensions, variables, attributes, and data values. There's an example and explanation of the CDL notation in section 2.1.2 of the NetCDF Fortran User's Guide at http://www.unidata.ucar.edu/packages/netcdf/guidef/guidef-7.html#HEADING7-6 Unfortunately the ncgen-generated code is a little obscure for writing "record" variables that have an unlimited dimension or for writing character-valued data in a portable way. So I made a simpler example that writes a file corresponding to the following CDL: http://www.unidata.ucar.edu/packages/netcdf/fortran77/ex0.cdl Here's the ncgen-generated Fortran code to create the corresponding netCDF file, "ex0.nc": http://www.unidata.ucar.edu/packages/netcdf/fortran77/ex0.f A similar program to read the data from that file is: http://www.unidata.ucar.edu/packages/netcdf/fortran77/exread0.f There are more complex examples explained in Chapter 4 of the User's Guide, and eventually we may get around to supplying some more complete examples on line. --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu ------- End of Forwarded Message