本文整理汇总了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)