本文整理匯總了Python中cdo.Cdo.trend方法的典型用法代碼示例。如果您正苦於以下問題:Python Cdo.trend方法的具體用法?Python Cdo.trend怎麽用?Python Cdo.trend使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cdo.Cdo
的用法示例。
在下文中一共展示了Cdo.trend方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_operators_with_multiple_output_files
# 需要導入模塊: from cdo import Cdo [as 別名]
# 或者: from cdo.Cdo import trend [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)