#include #include #include #include /************************** Function prototypes **************************/ void handle_netcdf_error (int); main(int argc, char **argv) { int ncID; int i, status, nvars; char varname[NC_MAX_NAME]; if (argc <= 1) { printf("Incorrect number of arguments\n"); exit(0); } if((status = nc_open(argv[1],0,&ncID)) != NC_NOERR){ printf("%d",status); exit(0); } status = nc_inq_nvars(ncID, &nvars); for (i = 0; i < nvars; i++) { status = nc_inq_varname(ncID, i, varname); if (strncmp(varname,"Time",4) != 0 && strncmp(varname,"StartTime",9) != 0 && strncmp(varname,"StopTime",8) != 0) printf("%s#",varname); } status = nc_close(ncID); } /*-------------------------------------------------------------------------- * Handles a netCDF error. *--------------------------------------------------------------------------*/ void handle_netcdf_error(int status) { fprintf(stderr, "%s\n", nc_strerror(status)); }