Describe file content
As mentioned previously, when accessing files, PnetCDF's definition mode typically precedes the data mode. The definition mode generally starts by defining one or more dimensions, as they are indispensable when arrays are to be included in the data file.
Dimension:
int ncmpi_def_dim(int id, const char *name, MPI_Offset len, int *dmids)
In this call, id corresponds to the netCDF ID assigned from a previous ncmpi_create()
or ncmpi_open()
call. The name parameter corresponds
to the dimension name and len is the length of the dimension. dmid is a pointer to the location of dimension ID, which just is an integer label assigned by PnetCDF.
Variable:
int ncmpi_def_var(int id, const char *name, nc_type type, int ndims, const int *dmids, int *vid)
The parameters id, name, and vid are similar to the ones in ncmpi_def_dim()
. The type parameter is one of the predefined netCDF external data types
such as NC_INT
, NC_DOUBLE
, etc. The ndims parameter represents the number of dimensions of the variable, whereas dmids is a vector of the relevant dimension IDs that were assigned during prior ncmpi_def_dim()
calls.
End of the definition mode:
int ncmpi_enddef(int id)