本文整理汇总了Python中cdo.Cdo.readCdf方法的典型用法代码示例。如果您正苦于以下问题:Python Cdo.readCdf方法的具体用法?Python Cdo.readCdf怎么用?Python Cdo.readCdf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cdo.Cdo
的用法示例。
在下文中一共展示了Cdo.readCdf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_icon_coords
# 需要导入模块: from cdo import Cdo [as 别名]
# 或者: from cdo.Cdo import readCdf [as 别名]
def test_icon_coords(self):
cdo = Cdo()
if cdo.hasNetcdf:
ifile = DATA_DIR +'/icon/oce_AquaAtlanticBoxACC.nc'
ivar = 't_acc'
varIn = cdo.readCdf(ifile)
varIn = varIn.variables[ivar]
expected = u'clon clat'
self.assertEqual(expected,varIn.coordinates)
varOut =cdo.readCdf(cdo.selname(ivar,input=ifile))
varOut = varOut.variables[ivar]
expected = u'clat clon'
self.assertEqual(expected,varOut.coordinates)
示例2: test_keep_coordinates
# 需要导入模块: from cdo import Cdo [as 别名]
# 或者: from cdo.Cdo import readCdf [as 别名]
def test_keep_coordinates(self):
cdo = Cdo()
ifile = '/pool/data/ICON/ocean_data/ocean_grid/iconR2B02-ocean_etopo40_planet.nc'
if (os.path.isfile(ifile)):
ivar = 'ifs2icon_cell_grid'
varIn = cdo.readCdf(ifile)
varIn = varIn.variables[ivar]
expected = 'clon clat'
self.assertEqual(expected,varIn.coordinates)
varOut =cdo.readCdf(cdo.selname(ivar,input=ifile))
varOut = varOut.variables[ivar]
expected = expected.split(' ')
expected.reverse()
self.assertEqual(expected,varOut.coordinates.split(' '))
示例3: test_readCdf
# 需要导入模块: from cdo import Cdo [as 别名]
# 或者: from cdo.Cdo import readCdf [as 别名]
def test_readCdf(self):
cdo = Cdo()
input= "-settunits,days -setyear,2000 -for,1,4"
cdfFile = cdo.copy(options="-f nc",input=input)
if cdo.hasNetcdf:
cdf = cdo.readCdf(cdfFile)
self.assertEqual(sorted(['lat','lon','for','time']),sorted(list(cdf.variables.keys())))