本文整理匯總了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())))