Go to the previous, next section.

ncgen

The ncgen tool generates a netCDF file or the C or FORTRAN programs required to create the netCDF file. If no options are specified in invoking ncgen, the program merely checks the syntax of the CDL input, producing error messages for any violations of CDL syntax. Other options can be used to create a netCDF file or to generate a program in C or FORTRAN that calls the routines required to create the netCDF file.

UNIX syntax for invoking ncgen:

ncgen [-b] [-o output-file] [-c] [-f] [-n] [input-file]
where:
`-b'
Create a (binary) netCDF file. If the `-o' option is absent, a default file name will be constructed from the netCDF name (specified after the netcdf keyword in the input) by appending the `.nc' extension. If a file already exists with the specified name it will be overwritten.

`-o outputfile'
Name for the netCDF file created. If this option is specified, it implies the `-b' option. (This option is necessary because netCDF files are direct-access files created with seek calls, and hence cannot be written to standard output.)

`-c'
Generate C source code that will create a netCDF file matching the netCDF specification. The C source code is written to standard output.

`-f'
Generate FORTRAN source code that will create a netCDF file matching the netCDF specification. The FORTRAN source code is written to standard output.

`-n'
Like the `-b' option, except creates a netCDF file with the obsolete `.cdf' extension instead of the `.nc' extension, in the absence of an output filename specified by the `-O' option. This option is only supported for backward compatibility.

Examples

Check the syntax of the CDL file `foo.cdl':

ncgen foo.cdl

From the CDL file `foo.cdl', generate an equivalent binary netCDF file named `flu.nc':

ncgen -o flu.nc foo.cdl

From the CDL file `foo.cdl', generate a C program containing the netCDF function invocations necessary to create an equivalent binary netCDF file named `flu.nc':

ncgen -c -o flu.nc foo.cdl

Go to the previous, next section.