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