read_netcdf.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:gridded 作者: NOAA-ORR-ERD 项目源码 文件源码
def is_valid_mesh(nc, varname):
    """
    determine if the given variable name is a valid mesh definition

    :param nc: a netCDF4 Dataset to check

    :param varname: name of the candidate mesh variable

    """
    try:
        mesh_var = nc.variables[varname]
    except KeyError:
        return False
    try:
        if (mesh_var.cf_role.strip() == 'mesh_topology' and
           int(mesh_var.topology_dimension) == 2):
            return True
    except AttributeError:
            # not a valid mesh variable
        return False

# Defining properties of various connectivity arrays
# so that the same code can load all of them.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号