我正在使用以下代码编写netCDF文件:
from netCDF4 import Dataset
outfile = Dataset('output.nc', 'w', format = 'NETCDF4')
level = outfile.createDimension('level', 1)
time = outfile.createDimension('t', None)
lats = outfile.createDimension('latitude', 141)
lons = outfile.createDimension('longitude', 121)
precips = outfile.createVariable('Precipitation', 'f4',('t','level','latitude','longitude'))
times = outfile.createVariable('t','f8',('t',))
levels = outfile.createVariable('level','i4',('level',))
latitudes = outfile.createVariable('latitude','f4',('latitude',))
longitudes = outfile.createVariable('longitude','f4',('longitude',))
latitudes.units = "degrees east"
longitudes.units = "degrees north"
levels.units = "surface"
precips.units = "mm/day"
times.calendar = "gregorian"
一切正常(一旦用数据填充变量并调用outfile.close()
),但是如何为变量分配一个短名称?我期待的是:
precips.shortFieldName = "prec"
但是,尝试了很多变体,并扫描了文档,并通过源代码进行了搜索,我不再接近解决方案了。
有什么想法吗?
答案 0 :(得分:0)
prec=precips
^^然后有关于这两个对象的指针
=>两个名字都可以使用