3.3 Reading NetCDF Files of Unknown Structure
Perhaps you would like to write your software to handle more general
cases, so that you don't have to adjust your source every time the
grid size changes, or a variable is added to the file.
There are inquiry functions that let you find out everything you need
to know about a file. These functions contain “inq” or “INQ” in
their names.
Using the inquiry functions, it is possible to write code that will
read and understand any netCDF file, whatever its contents. (For
example, ncdump does just that.)