Reading NetCDF in C Software Documentation

Reading NetCDF in C Software Documentation


Usage

 cdf2c [-v] [-o outputFile] inputFilePath  

This procedure creates a c routine to read in the data from a NetCDF file. The default mode, non-verbose output, outputs only the varaible data to the c routine.

The variables and global attributes have identical names to the variable and global attribute names in the NetCDF file. The attributes associated with a given variable have names preceded by the associated variable name.

[-v]

If this flag is set then the cdf2c program creates verbose output. All variable and global attributes in the netCDF file will be included in the resultant c routine.

[-o outputFile]

This flag allows you to enter an optional output filename for the routine produced by the program. The default is for the output to be written to stdout.

inputFilePath

The full path to the netCDF file for which you wish to create a c routine to read the data.

Prerequisites

This program CANNOT be compiled without the netCDF library. The source code for the netCDF library can be obtained via anonymous ftp to ftp.unidata.ucar.edu. The necessary files are located in the /pub/netcdf directory.

Additionally, the Makefile provided uses the gcc compiler to compile the program. You may substitute for your local compiler, but if you do, you will need to modify the Makefile to use the flags appropriate to your particular compiler. You may also obtain the gcc compiler, if you do not have it, via anonymous ftp to prep.ai.mit.edu. The gcc compiler is located in the /pub/gnu directory along with a suite of other free goodies.

Please read the Readme included with this release to ensure that the code compiles properly.

Example

Assuming you have met all of the prerequisites, and that you have followed
the instructions in the Readme file.


You may now add a main and any other functions you wish to manipulate the 
data to the routine in netCDF_reader.c.

Send your comments to the CIDS Aministrator.

Back to CIDS Page.