save_utils.py 文件源码

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

项目:regionmask 作者: mathause 项目源码 文件源码
def _create_file(filename, mask, lat, lon):
    """create the netcdf file to store the srex mask"""
    import netCDF4 as nc
    with nc.Dataset(filename, 'w') as ncf:

        ncf.createDimension('lat', size=lat.size)
        ncf.createDimension('lon', size=lon.size)

        ncf.createVariable('lat', 'f', 'lat')
        ncf.createVariable('lon', 'f', 'lon')
        ncf.createVariable('mask', 'f', ('lat', 'lon'))

        ncf.variables['lat'][:] = lat
        ncf.variables['lon'][:] = lon
        ncf.variables['mask'][:] = mask


# create unique filename for the mask
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号