属性信息写入
函数定义
- 写入属性。
nc_put_att(int ncid, int varid, const char* name, int xtype, size_t len, const void* op)
- 写入int类型属性。
nc_put_att_int(int ncid, int varid, const char* name, nc_type xtype, size_t len, const int *op)
- 写入float类型属性。
nc_put_att_float(int ncid, int varid, const char* name, nc_type xtype, size_t len, const float *op)
- 写入double类型属性。
nc_put_att_double(int ncid, int varid, const char* name, nc_type xtype, size_t len, const double *op)
- 写入文本类型属性。
nc_put_att_text(int ncid, int varid, const char* name, size_t len, const char *op)
参数
参数名 |
描述 |
取值范围 |
输入/输出 |
---|---|---|---|
ncid |
文件ID |
非负整数 |
输入 |
varid |
variable ID |
非负整数 |
输入 |
xtype |
attribute类型 |
非负整数 |
输入 |
name |
attribute名称 |
非空 |
输入 |
len |
attribute名称长度 |
非负整数 |
输入 |
op |
数据指针 |
非空 |
输入 |
返回值
- 成功:返回NC_NOERR。
- 失败:返回错误码。
错误码
错误码 |
描述 |
---|---|
NC_EBADID |
无效ncid |
NC_ENOTVAR |
无效variableid |
NC_EINVAL |
无效参数 |
NC_ENOMEM |
内存不足 |
注意
- 用户需要保证指针内存大小正确性,中间件无法检查指针大小。
- 目前仅支持上述类型att的写入,需要保证类型与函数对应。
- nc_type是int类型的别名。
父主题: NetCDF桥接函数