Previous: Reading The 4D Example in C Next: Reading a NetCDF Dataset with Unknown Names Table of contents Frames 2010 Unidata NetCDF Workshop > Introduction to the NetCDF APIs and Example Programs

9.25 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 2010 Unidata NetCDF Workshop > Introduction to the NetCDF APIs and Example Programs