本文整理汇总了Python中Scientific.IO.NetCDF.NetCDFFile.variables['LwToaCf'][l]方法的典型用法代码示例。如果您正苦于以下问题:Python NetCDFFile.variables['LwToaCf'][l]方法的具体用法?Python NetCDFFile.variables['LwToaCf'][l]怎么用?Python NetCDFFile.variables['LwToaCf'][l]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scientific.IO.NetCDF.NetCDFFile
的用法示例。
在下文中一共展示了NetCDFFile.variables['LwToaCf'][l]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
# 需要导入模块: from Scientific.IO.NetCDF import NetCDFFile [as 别名]
# 或者: from Scientific.IO.NetCDF.NetCDFFile import variables['LwToaCf'][l] [as 别名]
def test(self):
# Create file
FileName = '%s_out.nc' % self.Case
print 'creating %s ...' % FileName
File = NetCDFFile(FileName,'w')
File.createDimension('time',None)
var = File.createVariable('time','f',('time',))
var.long_name = 'time'
var.units = ' '
File.createDimension('lat',len(self.data.lat))
var = File.createVariable('lat','f',('lat',))
var.long_name = 'latitude'
var.units = 'degrees_north'
var[:] = self.data.lat.astype('f')
File.createDimension('lon',len(self.data.lon))
var = File.createVariable('lon','f',('lon',))
var.long_name = 'longitude'
var.units = 'degrees_east'
var[:] = self.data.lon.astype('f')
for Field in ['SwToa','LwToa','SwToaCf','LwToaCf']:
var = File.createVariable(Field,'f',('time','lat','lon'))
var.long_name = ''
var.units = 'W m-2'
lmax = 3
for l in range(lmax):
print 'doing %s of %s' % (l+1,lmax)
# get data
Data = self.getFields(l)[0]
Data.update(self.Fixed)
# compute
self.r(**Data)
File.variables['SwToa'][l] = self.r['SwToa'].astype('f')
File.variables['LwToa'][l] = -self.r['LwToa'].astype('f')
File.variables['SwToaCf'][l] = self.r['SwToaCf'].astype('f')
File.variables['LwToaCf'][l] = self.r['LwToaCf'].astype('f')
File.close()