Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

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 (The NetCDF C Interface Guide).

nc_create (The NetCDF C Interface Guide) create a new netCDF file


nc_def_dim (The NetCDF C Interface Guide) define a dimension


nc_def_var (The NetCDF C Interface Guide) define a variable


nc_put_att_ type (The NetCDF C Interface Guide) write attributes


nc_enddef (The NetCDF C Interface Guide) leave define mode


nc_put_vara_ type (The NetCDF C Interface Guide) write arrays of data


nc_close (The NetCDF C Interface Guide) close a file
 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Office of Programs University Corporation for Atmospheric Research (UCAR)   Unidata is a member of the UCAR Office of Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690