Next: , Previous: Creation, Up: Creation


3.1.1 Creating a NetCDF File in C

Use nc_create to create a file. Then use nc_def_dim to define each shared dimension. The data variables are then specified with nc_def_var. Any attributes are added with nc_put_att. Finally, call nc_enddef to tell the library that you are done defining the metadata, and ready to start writing the data.

After all data are written to the file, call nc_close to ensure that all buffers are flushed, and any resources associated with the open file are returned to the operating system.

For a very simple example, See simple_xy in C.

For a typical sequence of calls to the C versions of these functions, see See Creating a NetCDF Dataset.

nc_create create a new netCDF file


nc_def_dim define a dimension


nc_def_var define a variable


nc_put_att_ type write attributes


nc_enddef leave define mode


nc_put_vara_ type write arrays of data


nc_close close a file