本文整理汇总了Python中cdo.Cdo.version方法的典型用法代码示例。如果您正苦于以下问题:Python Cdo.version方法的具体用法?Python Cdo.version怎么用?Python Cdo.version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cdo.Cdo
的用法示例。
在下文中一共展示了Cdo.version方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_smooth
# 需要导入模块: from cdo import Cdo [as 别名]
# 或者: from cdo.Cdo import version [as 别名]
def test_smooth(self):
cdo = Cdo()
if (parse_version(cdo.version()) >= parse_version('1.7.2') and cdo.hasNetcdf):
ifile = "-select,level=0 " + DATA_DIR + '/icon/phc.nc'
cdo = Cdo()
cdo.debug = DEBUG
#cdo.merge(input='/home/ram/data/icon/input/phc3.0/PHC__3.0__TempO__1x1__annual.nc /home/ram/data/icon/input/phc3.0/PHC__3.0__SO__1x1__annual.nc',
# output=ifile,
# options='-O')
smooth = cdo.smooth(input=" -sellonlatbox,0,30,0,90 -chname,SO,s,TempO,t " + ifile, returnMaArray='s',options='-f nc')
plot(np.flipud(smooth[0,:,:]),ofile='smooth',title='smooth')
smooth2 = cdo.smooth('nsmooth=2',input="-sellonlatbox,0,30,0,90 -chname,SO,s,TempO,t " + ifile, returnMaArray='s',options='-f nc')
plot(np.flipud(smooth2[0,:,:]),ofile='smooth2',title='smooth,nsmooth=2')
smooth4 = cdo.smooth('nsmooth=4',input="-sellonlatbox,0,30,0,90 -chname,SO,s,TempO,t " + ifile, returnMaArray='s',options='-f nc')
plot(np.flipud(smooth4[0,:,:]),ofile='smooth4',title='smooth,nsmooth=4')
smooth9 = cdo.smooth9(input="-sellonlatbox,0,30,0,90 -chname,SO,s,TempO,t " + ifile, returnMaArray='s',options='-f nc')
plot(np.flipud(smooth9[0,:,:]),ofile='smooth9',title='smooth9')
smooth3deg = cdo.smooth('radius=6deg',input="-sellonlatbox,0,30,0,90 -chname,SO,s,TempO,t " + ifile, returnMaArray='s',options='-f nc')
plot(np.flipud(smooth3deg[0,:,:]),ofile='smooth3deg',title='smooth,radius=6deg')
smooth20 = cdo.smooth('nsmooth=20',input="-sellonlatbox,0,30,0,90 -chname,SO,s,TempO,t " + ifile, returnMaArray='s',options='-f nc')
plot(np.flipud(smooth20[0,:,:]),ofile='smooth20',title='smooth,nsmooth=20')
示例2: test_operators_with_multiple_output_files
# 需要导入模块: from cdo import Cdo [as 别名]
# 或者: from cdo.Cdo import version [as 别名]
def test_operators_with_multiple_output_files(self):
cdo = Cdo()
self.assertEqual(1 ,cdo.operators['topo'],'wrong output counter for "topo"')
self.assertEqual(0 ,cdo.operators['sinfo'],'wrong output counter for "sinfo"')
self.assertEqual(-1,cdo.operators['splitsel'],'wrong output counter for "splitsel"')
self.assertEqual(2 ,cdo.operators['trend'],'wrong output counter for "trend"')
if (parse_version(cdo.version()) > parse_version('1.6.4')):
self.assertEqual(0,cdo.operators['ngridpoints'],'wrong output counter for "sinfo"')
# create input for eof
#
# check automatic generation ot two tempfiles
aFile, bFile = cdo.trend(input = "-addc,7 -mulc,44 -for,1,100")
self.assertTrue(os.path.exists(aFile),"cannot find tempfile")
self.assertTrue(os.path.exists(bFile),"cannot find tempfile")
self.assertEqual(51.0,float(cdo.outputkey('value',input = aFile)[-1]))
self.assertEqual(44.0,float(cdo.outputkey('value',input = bFile)[-1]))
# check usage of 'returnCdf' with these operators
if cdo.hasNetcdf:
aFile, bFile = cdo.trend(input = "-addc,7 -mulc,44 -for,1,100",returnCdf = True)
self.assertEqual(51.0, aFile.variables['for'][0],"got wrong value from cdf handle")
self.assertEqual(44.0, bFile.variables['for'][0],"got wrong value from cdf handle")
avar = cdo.trend(input = "-addc,7 -mulc,44 -for,1,100",returnArray = 'for')[0]
self.assertEqual(51.0, avar,"got wrong value from narray")
else:
self.assertRaises(ImportError,cdo.trend, input = "-addc,7 -mulc,44 -for,1,100",returnCdf = True)
示例3: testOps
# 需要导入模块: from cdo import Cdo [as 别名]
# 或者: from cdo.Cdo import version [as 别名]
def testOps(self):
cdo = Cdo()
self.assertTrue("sinfov" in cdo.operators)
self.assertTrue("for" in cdo.operators)
self.assertTrue("mask" in cdo.operators)
if (parse_version('1.7.0') >= parse_version(cdo.version())):
self.assertTrue("studentt" in cdo.operators)
self.assertTrue(len(cdo.operators) > 700)
示例4: test_phc
# 需要导入模块: from cdo import Cdo [as 别名]
# 或者: from cdo.Cdo import version [as 别名]
def test_phc(self):
ifile = "-select,level=0 " + DATA_DIR + '/icon/phc.nc'
cdo = Cdo()
cdo.debug = DEBUG
if not cdo.hasNetcdf:
return
#cdo.merge(input='/home/ram/data/icon/input/phc3.0/PHC__3.0__TempO__1x1__annual.nc /home/ram/data/icon/input/phc3.0/PHC__3.0__SO__1x1__annual.nc',
# output=ifile,
# options='-O')
s = cdo.sellonlatbox(0,30,0,90, input="-chname,SO,s,TempO,t " + ifile,output='test_my_phc.nc',returnMaArray='s',options='-f nc')
plot(np.flipud(s[0,:,:]),ofile='org',title='original')
sfmo = cdo.sellonlatbox(0,30,0,90, input="-fillmiss -chname,SO,s,TempO,t " + ifile,returnMaArray='s',options='-f nc')
plot(np.flipud(sfmo[0,:,:]),ofile='fm',title='fillmiss')
sfm = cdo.sellonlatbox(0,30,0,90, input="-fillmiss2 -chname,SO,s,TempO,t " + ifile,returnMaArray='s',options='-f nc')
plot(np.flipud(sfm[0,:,:]),ofile='fm2',title='fillmiss2')
ssetmisstonn = cdo.sellonlatbox(0,30,0,90, input="-setmisstonn -chname,SO,s,TempO,t " + ifile,returnMaArray='s',options='-f nc')
plot(np.flipud(ssetmisstonn[0,:,:]),ofile='setmisstonn',title='setmisstonn')
if (parse_version(cdo.version()) >= parse_version('1.7.2')):
smooth = cdo.sellonlatbox(0,30,0,90, input="-smooth -chname,SO,s,TempO,t " + ifile,returnMaArray='s',options='-f nc')
plot(np.flipud(ssetmisstonn[0,:,:]),ofile='smooth',title='smooth')
示例5: test_V
# 需要导入模块: from cdo import Cdo [as 别名]
# 或者: from cdo.Cdo import version [as 别名]
def test_V(self):
cdo = Cdo()
print(cdo.version(verbose=True))