Rate This Document
Findability
Accuracy
Completeness
Readability

Attribute Information Reading

Function Syntax

  • Read an attribute.

    nc_get_att(int ncid, int varid, const char* name, void *ip)

  • Read an attribute of the int type.

    nc_get_att_int(int ncid, int varid, const char* name, int *ip)

  • Read an attribute of the float type.

    nc_get_att_float(int ncid, int varid, const char* name, float *ip)

  • Read an attribute of the double type.

    nc_get_att_double(int ncid, int varid, const char* name, double *ip)

  • Read an attribute of the text type.

    nc_get_att_text(int ncid, int varid, const char* name, char *ip)

Parameters

Parameter

Description

Value Range

Input/Output

ncid

File ID

Non-negative integer

Input

varid

Variable ID

Non-negative integer

Input

name

Attribute name

Non-empty

Input

ip

Pointer to data

Non-empty

Output

Return Value

  • Success: NC_NOERR
  • Failure: An error code is returned.

Error Code

Error Code

Description

NC_EBADID

Invalid ncid

NC_ENOTVAR

Invalid variable ID

NC_ENOTATT

Attribute not found

NC_EINVAL

Invalid argument

NC_ENOMEM

Insufficient memory

Notes

  • Ensure that the pointer memory size is correct. Hyper IO cannot check the pointer size.
  • Only attributes of the preceding types can be read.