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
评论列表
文章目录