Querying Variable and Attribute Information
Function Syntax
- Query variable information.
int ncmpi_inq_varid(int fileId, const char* name, int* idPoint);
int ncmpi_inq_var(int fileId, int variableId, char* name, int* ncDataType, int* dimNumber, int* dimsArray, int* nattsp);
int ncmpi_inq_varndims(int fileId, int variableId, int* dimNumber);
- Query attribute information.
int ncmpi_inq_att(int fileId, int varId, const char* name, int* xtypep, MPI_Offset* lenp);
int ncmpi_inq_attname(int fileId, int varId, int attNum, char* name);
Parameters
Parameter |
Description |
Value Range |
Input/Output |
|---|---|---|---|
fileId |
File ID |
Non-negative integer |
Input |
*idPoint |
Pointer to the variable ID |
Non-empty |
Output |
variableId/varId |
varid |
Non-negative integer |
Input |
const *name |
Variable or attribute name |
Non-empty string of less than 256 bytes |
Input |
*name |
Variable or attribute name |
Non-empty |
Output |
*ncDataType |
Pointer to the variable data type |
Non-empty |
Output |
*dimNumber |
Pointer to the number of dimensions |
Non-empty |
Output |
*dimsArray |
Pointer to the dimension ID array |
Non-empty |
Output |
*nattsp |
Pointer to the number of attributes |
Non-empty |
Output |
*xtypep |
Pointer to the attribute type |
Non-empty |
Output |
*lenp |
Pointer to the number of attributes |
Non-empty |
Output |
attNum |
att ID |
Non-negative integer |
Input |
Return Value
- Success: NC_NOERR
- Failure: An error code is returned.
Error Code
Error Code |
Description |
|---|---|
NC_EBADID |
Invalid ncid |
NC_EBADDIM |
Invalid dimid |
NC_ENOMEM |
Null pointer or invalid memory |
NC_EBADNAME |
Invalid name |
Notes
*idPoint, *name, *ncDataType, *dimNumber, *dimsArray, *nattsp, *xtypep, and *lenp can be null pointers only if no data needs to be obtained.