This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
"Chad Saxon, Contractor" <address@hidden> writes: > I am thinking I have use nc_inq_vardimid to get info about the variables > dimensions or more specifically what dimensions are used by a certain > variable? > For simplicity I suggest you use nc_inq, nc_inq_dim, nc_inq_var, and nc_inq_att. Those 4 functions tell you everything. Whatever you are not interested in, just ignore. Any pointer parameter of those functions can be handed a NULL if you don't care about that parameter. To find out about a var: EXTERNL int nc_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, int *dimidsp, int *nattsp); Use it like this: int nvars, ndims, ngatts, unlimdimid; int ncid, varid, ndims, dimids[NC_MAX_DIMS], natts; char name[NC_MAX_NAME + 1]; nc_type xtype; int v; if (nc_open(PATH, 0, &ncid)) return 2; if (nc_inq(ncid, &ndims, &nvars, &ngatts, &unlimdimid)) return 2; for (v = 0; v < nvars; v++) { if (nc_inq_var(ncid, v, name, &xtype, &ndims, dimids, &natts)) return 2; /* Now use dimids... */ } Let me know if this helps! Ed -- Ed Hartnett -- address@hidden