Next: ncmpi_inq_varid, Previous: ncmpi_inq_var_fill, Up: Variables [Index]
ncmpi_fill_var_recThe API ncmpi_fill_var_rec fills a record of a record variable with predefined or user-defined fill values. It is available in version 1.6.1 and later.
This API is collective and can only be called in collective data mode.
int ncmpi_fill_var_rec(int ncid,
int varid,
MPI_Offset recno);
ncidNetCDF ID, from a previous call to ncmpi_open or ncmpi_create.
varidVariable ID. This value must be consistent across all calling MPI processes.
recnoindex of the record to be filled
ncmpi_fill_var_rec returns the value NC_NOERR if no errors occurred. Otherwise, the returned status indicates an error. Possible causes of errors include:
#include <pnetcdf.h>
... /* create a file */
/* define dimensions */
status = ncmpi_def_dim(ncid, "rec_dim", NC_UNLIMITED, &dimids[0]);
if (status != NC_NOERR) handle_error(status);
status = ncmpi_def_dim(ncid, "lon_dim", 1024, &dimids[1]);
if (status != NC_NOERR) handle_error(status);
status = ncmpi_def_dim(ncid, "lat_dim", 1024, &dimids[2]);
if (status != NC_NOERR) handle_error(status);
...
/* define variables */
status = ncmpi_def_var(ncid, "rec_var", NC_DOUBLE, 3, dimids, &varid);
if (status != NC_NOERR) handle_error(status);
...
status = ncmpi_enddef(ncid);
if (status != NC_NOERR) handle_error(status);
/* fill the first record of variable rec_var */
status = ncmpi_fill_var_rec(ncid, varid, 0);
if (status != NC_NOERR) handle_error(status);
/* fill the second record of variable rec_var */
status = ncmpi_fill_var_rec(ncid, varid, 1);
if (status != NC_NOERR) handle_error(status);
Next: ncmpi_inq_varid, Previous: ncmpi_inq_var_fill, Up: Variables [Index]