本文整理汇总了Python中Scientific.IO.NetCDF.NetCDFFile.variables['t'][:]方法的典型用法代码示例。如果您正苦于以下问题:Python NetCDFFile.variables['t'][:]方法的具体用法?Python NetCDFFile.variables['t'][:]怎么用?Python NetCDFFile.variables['t'][:]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scientific.IO.NetCDF.NetCDFFile
的用法示例。
在下文中一共展示了NetCDFFile.variables['t'][:]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: round
# 需要导入模块: from Scientific.IO.NetCDF import NetCDFFile [as 别名]
# 或者: from Scientific.IO.NetCDF.NetCDFFile import variables['t'][:] [as 别名]
print ""
print "***"
print age
print "***"
print ""
Qll = np.array(grass.vector_db_select('discharge_to_coast_'+age).values()[0].values(), dtype=float) # Any possible point precision issues can be rounded;
for row in Qll:
# Summing these into gridded bins here
discharge_grid[lats == round(row[-1],3), lons == round(row[-2],2)] += row[1]
t.append(age)
Qout.append(discharge_grid.copy()) # "copy" important! otherwise points to zeroed grid.
print "Total discharge = ", np.sum(Qout[-1])
discharge_grid *= 0
# Towards netcdf export
#shutil.copyfile('qrparm.waterfix.hadcm3_bbc15ka.nc', dst)
newnc = NetCDFFile(outname, 'w')
newnc.createDimension('t', len(t))
newnc.createDimension('longitude', len(lons))
newnc.createDimension('latitude', len(lats))
newnc.createVariable('t', 'i', ('t',))
newnc.createVariable('longitude', 'f', ('longitude',))
newnc.createVariable('latitude', 'f', ('latitude',))
newnc.createVariable('discharge', 'd', ('t', 'latitude', 'longitude'))
newnc.variables['t'][:] = t
newnc.variables['longitude'][:] = elons
newnc.variables['latitude'][:] = lats
newnc.variables['discharge'][:] = np.array(Qout)
newnc.close()