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