Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

netcdf.inqGrpParent

检索父组的 ID。

语法

parentGroupID = netcdf.inqGrpParent(ncid)

说明

parentGroupID = netcdf.inqGrpParent(ncid) 根据由 ncid 指定的子组位置,返回父组的 ID。

输入参数

ncid

netcdf.createnetcdf.open 返回的 NetCDF 文件标识符,或者由 netcdf.defGrp 返回的 NetCDF 组标识符。

输出参数

parentGroupID

指定的文件或组的父级 NetCDF 组或文件标识符。

示例

本例打开 NetCDF 示例文件并获取指定组的父级的完整路径。

ncid = netcdf.open('example.nc','NOWRITE');
gid = netcdf.inqNcid(ncid,'grid2');
parentId = netcdf.inqGrpParent(gid);
fullName = netcdf.inqGrpNameFull(parentId);
netcdf.close(ncid);

参考

此函数对应于 netCDF 库 C API 中的 nc_inq_grp_parent 函数。

另请参阅