本文整理匯總了Python中cdo.Cdo.sinfo方法的典型用法代碼示例。如果您正苦於以下問題:Python Cdo.sinfo方法的具體用法?Python Cdo.sinfo怎麽用?Python Cdo.sinfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cdo.Cdo
的用法示例。
在下文中一共展示了Cdo.sinfo方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_returnNone
# 需要導入模塊: from cdo import Cdo [as 別名]
# 或者: from cdo.Cdo import sinfo [as 別名]
def test_returnNone(self):
cdo = Cdo()
self.assertFalse(cdo.returnNoneOnError,"'returnNoneOnError' is _not_ False after initialization")
cdo.returnNoneOnError = True
self.assertTrue(cdo.returnNoneOnError,"'returnNoneOnError' is _not_ True after manual setting")
ret = cdo.sinfo(input="-topf")
self.assertEqual(None,ret)
if DEBUG:
print(ret)
cdo_ = Cdo(returnNoneOnError=True)
self.assertTrue(cdo_.returnNoneOnError)
ret = cdo_.sinfo(input=" ifile.grb")
self.assertEqual(None,ret)
if DEBUG:
print(ret)
示例2: test_outputOperators
# 需要導入模塊: from cdo import Cdo [as 別名]
# 或者: from cdo.Cdo import sinfo [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=' '))