Rate This Document
Findability
Accuracy
Completeness
Readability

Attribute Information Writing

Function Syntax

  • Write an attribute of the char type.

    int ncmpi_put_att_text(int fileId, int varId, const char* name, MPI_Offset nelems, const char* buf);

  • Write an attribute of the int type.

    int ncmpi_put_att_int(int fileId, int varId, const char* name, int xType, MPI_Offset nelems, const int* buf);

  • Write an attribute of the float type.

    int ncmpi_put_att_float(int fileId, int varId, const char* name, int xType, MPI_Offset nelems, const float* buf);

  • Write an attribute of the double type.

    int ncmpi_put_att_double(int fileId, int varId, const char* name, int xType, MPI_Offset nelems, const double* buf);

Parameters

Parameter

Description

Value Range

Input/Output

fileId

File ID

Non-negative integer

Input

varId

Variable ID

Non-negative integer

Input

*name

Attribute name

Non-empty string of less than 256 bytes

Input

nelems

Length of information to write

Non-negative integer

Input

*buf

Pointer to the buffer for writing attribute information

Non-empty

Input

xtype

Data type of the attribute to write

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_EBADNAME

Invalid name

NC_ENOMEM

Null pointer or invalid memory

NC_EINVAL

Invalid argument