2009 Unidata NetCDF Workshop for Developers and Data Providers > NetCDF Utilities: ncdump and ncgen
5.9 ncgen
ncgen can generate a netCDF file, C program, or
Fortran program from a CDL file.
The ncgen utility can do the following with CDL input:
- Reverse what ncdump does, converting CDL to
binary netCDF, for example:
ncgen -o mslp.nc mslp.cdl
- Generate a C or Fortran program that, when compiled and run, will create a
netCDF file corresponding to the CDL:
ncgen -c mslp.cdl > mslp.c
or
ncgen -f mslp.cdl > mslp.f
NetCDF-4 note:
The current snapshot release of netCDF-4
includes an ncgen4 tool that handles features of the netCDF-4 data
model in CDL. It can generate binary netCDF files, C, or NcML, but not
Fortran yet. To build it requires a non-default configure option,
--enable-ncgen4
.
2009 Unidata NetCDF Workshop for Developers and Data Providers > NetCDF Utilities: ncdump and ncgen