Query data
Querying data is useful in understanding the structure of the dataset, especially while reading the dataset from a file. From the
application's perspective, it provides a mechanism to map the dataset to appropriate data structures within the application. For example, the
ncmpi_inq_dimXX()
family of functions may be used to inquire about the dimensions of a given dataset, which can in turn be used to construct multi-dimensional arrays.
Following are a few types of functions for making
queries using the PnetCDF API.
Querying a variable
There are quite a few functions of the form ncmpi_inq_varXX()
for retrieving information about a PnetCDF variable. As examples:
Returns a pointer varid to the variable ID corresponding to the variable name. One can use this ID while making other inquiries about the variable as shown below.
Returns the variable name corresponding to the variable id varid.
Returns the type of the variable represented by varid. For example, it would be one of NC_FLOAT
, NC_INT
and so on.
Returns a vector of dimension IDs corresponding to varid.
Querying a dimension
Returns a pointer dimid for a given dimension name dim_name. One can use this ID for retrieving information about a particular dimension. For example, the next function accepts the dimid as an argument.
Returns the length of the dimension corresponding to the dimension id dimid.
Querying a file
Returns in "size" the amount of data that were written (ncmpi_inq_put_size()
) or read (ncmpi_inq_get_size()
)
to/from a netCDF file since creating or opening the file.
Returns in info (an MPI_Info
object) the I/O hints used by the PnetCDF library for the file.