Previous: Reading a NetCDF Dataset with Known Names Next: Some Common Errors to Avoid Table of contents Frames 2012 Unidata NetCDF Workshop > Using netCDF in programs

11.3 Reading a NetCDF Dataset with Unknown Names
Abstract code for reading a "classic" netCDF dataset of unknown structure.

You can write generic software that

In the C or Fortran APIs, information about netCDF objects is obtained by calling inquire functions:

     nc_open                   /* open existing netCDF dataset */
       ...
     nc_inq                    /* find out what is in it */
          ...
        nc_inq_dim             /* get dimension names, lengths */
          ...
        nc_inq_var             /* get variable names, types, shapes */
             ...
           nc_inq_attname      /* get attribute names */
             ...
           nc_inq_att          /* get attribute types and lengths */
             ...
           nc_get_att          /* get attribute values */
             ...
        nc_get_var             /* get values of variables */
          ...
     nc_close                  /* close netCDF dataset */

In netCDF, inquire functions are very fast, since the information they provide is stored in memory when a netCDF dataset is first opened.

 


Previous: Reading a NetCDF Dataset with Known Names Next: Some Common Errors to Avoid Table of contents Frames 2012 Unidata NetCDF Workshop > Using netCDF in programs