|
NEP 2.7.0
NetCDF Extension Pack
|
Read a NetCDF file and print all metadata (dimensions, variables, attributes) More...
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <netcdf.h>Macros | |
| #define | ERRCODE 2 |
| #define | ERR(e) {printf("Error: %s\n", nc_strerror(e)); return ERRCODE;} |
Functions | |
| static const char * | type_name (nc_type xtype) |
| static int | print_att_value (int ncid, int varid, const char *att_name, nc_type xtype, size_t len) |
| static int | print_attributes (int ncid, int varid, int natts, const char *indent) |
| int | main (int argc, char *argv[]) |
Read a NetCDF file and print all metadata (dimensions, variables, attributes)
This example demonstrates how to use the NetCDF inquiry functions to discover and print all metadata in a NetCDF file without prior knowledge of its contents. It reads a filename from the command line, opens the file, and prints:
This is a useful pattern for building tools that inspect arbitrary NetCDF files.
Learning Objectives:
Key Concepts:
Prerequisites:
Related Examples:
Compilation:
Usage:
Expected Output: Prints all metadata from the specified file:
| #define ERR | ( | e | ) | {printf("Error: %s\n", nc_strerror(e)); return ERRCODE;} |
| #define ERRCODE 2 |
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
|
static |
|
static |
|
static |