Previous: ncdump Next: Unicode Names Table of contents Frames User guide
2008 Unidata NetCDF Workshop for Developers and Data Providers > NetCDF Utilities

4.1 ncgen
The ncgen utility can generate a netCDF file, a C program, or a Fortran program from a human-readable (and editable) CDL file.

 

The ncgen utility can do the following with CDL input:

Programming tip: if a program (e.g. a model) needs to create a netCDF file of specified structure, use a CDL file and ncgen to create the empty netCDF file with no data, then write the data using the appropriate "put_var" calls. For files with lots of metadata, this is easier than writing all the "boiler-plate" code to create the needed dimensions, attributes, and variables manually.

You can use ncdump and ncgen together for some simple netCDF editing:

The Java tool toolsUI available with the netCDF Java package can similarly be used to convert back and forth between netCDF data and editable NcML.

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 or C, but not Fortran yet. To build it requires a non-default configure option, --enable-ncgen4 .

 


Previous: ncdump Next: Unicode Names Table of contents Frames User guide
2008 Unidata NetCDF Workshop for Developers and Data Providers > NetCDF Utilities