本文整理汇总了Python中cdo.Cdo.showlevel方法的典型用法代码示例。如果您正苦于以下问题:Python Cdo.showlevel方法的具体用法?Python Cdo.showlevel怎么用?Python Cdo.showlevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cdo.Cdo
的用法示例。
在下文中一共展示了Cdo.showlevel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_outputOperators
# 需要导入模块: from cdo import Cdo [as 别名]
# 或者: from cdo.Cdo import showlevel [as 别名]
def test_outputOperators(self):
cdo = Cdo()
levels = cdo.showlevel(input = "-stdatm,0")
info = cdo.sinfo(input = "-stdatm,0")
self.assertEqual([0,0],list(map(float,levels)))
self.assertEqual("GRIB",info[0].split(' ')[-1])
values = cdo.outputkey("value",input="-stdatm,0")[1::]
self.assertEqual(["1013.25", "288"],values)
values = cdo.outputkey("value",input="-stdatm,0,10000")[1::]
self.assertEqual(["1013.2", "271.9", "288.0", "240.6"],['{:.1f}'.format(float(s)) for s in values])
values = cdo.outputkey("lev",input="-stdatm,0,10000")[1::]
self.assertEqual(["0", "10000","0", "10000"],values)
# test autoSplit usage
levels = cdo.showlevel(input="-stdatm,0,10,20",autoSplit=' ')
self.assertEqual([['0','10','20'],['0','10','20']],levels)
timesExpected = ['2001-01-01T12:00:00',
'2001-01-01T13:00:00',
'2001-01-01T14:00:00',
'2001-01-01T15:00:00',
'2001-01-01T16:00:00',
'2001-01-01T17:00:00',
'2001-01-01T18:00:00',
'2001-01-01T19:00:00',
'2001-01-01T20:00:00',
'2001-01-01T21:00:00']
self.assertEqual(timesExpected,
cdo.showtimestamp(input="-settaxis,2001-01-01,12:00,1hour -for,1,10", autoSplit=' '))
self.assertEqual(['P T'],cdo.showname(input="-stdatm,0"))
self.assertEqual(['P','T'],cdo.showname(input="-stdatm,0",autoSplit=' '))
示例2: test_showlevels
# 需要导入模块: from cdo import Cdo [as 别名]
# 或者: from cdo.Cdo import showlevel [as 别名]
def test_showlevels(self):
cdo = Cdo()
sourceLevels = "25 100 250 500 875 1400 2100 3000 4000 5000".split()
self.assertEqual(' '.join(sourceLevels),
cdo.showlevel(input = "-selname,T " + cdo.stdatm(','.join(sourceLevels),options = "-f nc"))[0])