Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 
Previous: Reading The 4D Example in C Next: Reading a NetCDF Dataset with Unknown Names Table of contents Frames User guide
2008 Unidata NetCDF Workshop for Developers and Data Providers > NetCDF Example Programs

6.12 Reading a NetCDF Dataset with Known Names
Abstract code for reading a netCDF dataset of known structure.

Consider the case where you know the names of not only the netCDF datasets, but also the names of their dimensions, variables, and attributes. The order of typical C calls to read data from those variables in a netCDF dataset is (with arguments and error handling not shown):

     nc_open                /* open existing netCDF dataset */
          ...
        nc_inq_dimid        /* get dimension IDs */
          ...
        nc_inq_varid        /* get variable IDs */
          ...
        nc_get_att          /* get attribute values */
          ...
        nc_get_var          /* get values of variables */
          ...
     nc_close               /* close netCDF dataset */

 


Previous: Reading The 4D Example in C Next: Reading a NetCDF Dataset with Unknown Names Table of contents Frames User guide
2008 Unidata NetCDF Workshop for Developers and Data Providers > NetCDF Example Programs

 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community 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