文件操作
函数定义
- 创建文件。
NC_create(const char *name, int mode, size_t initialsz, int basepe,
size_t *chunksizehintp, int useparallel, void *parameters, int *ncidp)
- 创建文件进行并行IO。
nc_create_par(const char *name, int mode, MPI_Comm comm, MPI_Info info, int* ncidp)
- 打开现有文件。
NC_open(const char *name, int mode, int basepe, size_t *chunksizehintp,
int useparallel, void *parameters, int *ncidp)
- 打开现有文件进行并行IO。
nc_open_par(const char *name, int mode, MPI_Comm comm, MPI_Info info, int* ncidp)
- 关闭打开的文件。
- 进入定义模式。
- 退出定义模式。
参数
参数名 |
描述 |
取值范围 |
输入/输出 |
---|---|---|---|
ncid |
文件ID |
非负整数 |
输入 |
*ncidp |
返回文件ID的指针 |
非空 |
输出 |
*name |
文件名称 |
非空,长度小于256字节 |
输入 |
comm |
MPI通信器句柄 |
非空 |
输入 |
info |
MPIinfo对象句柄 |
非空 |
输入 |
*chunksizehintp |
分块大小指针 |
非空 |
输入 |
useparallel |
是否开启并行IO |
整数 |
输入 |
*parameters |
存储MPI信息的结构体指针 |
非空 |
输入 |
mode |
创建/打开模式 |
整数 |
输入 |
initialsz |
初始化大小 |
非负整数 |
输入 |
basepe |
基本处理元素 |
整数 |
输入 |
返回值
- 成功:返回NC_NOERR。
- 失败:返回错误码。
错误码
错误码 |
描述 |
---|---|
NC_EBADID |
无效ncid |
NC_EINVAL |
无效参数 |
NC_ENOMEM |
内存不足 |
父主题: NetCDF桥接函数