本文整理汇总了Python中PISM.optionsStringArray方法的典型用法代码示例。如果您正苦于以下问题:Python PISM.optionsStringArray方法的具体用法?Python PISM.optionsStringArray怎么用?Python PISM.optionsStringArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PISM
的用法示例。
在下文中一共展示了PISM.optionsStringArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: options_test
# 需要导入模块: import PISM [as 别名]
# 或者: from PISM import optionsStringArray [as 别名]
def options_test():
"Test command-line option handling"
ctx = PISM.Context()
o = PISM.PETSc.Options()
M = PISM.optionsInt("-M", "description", default=100)
M = PISM.optionsInt("-M", "description", default=None)
S = PISM.optionsString("-S", "description", default="string")
S = PISM.optionsString("-S", "description", default=None)
R = PISM.optionsReal("-R", "description", default=1.5)
R = PISM.optionsReal("-R", "description", default=None)
o.setValue("-B", "on")
B = PISM.optionsFlag("-B", "description", default=False)
B = PISM.optionsFlag("B", "description", default=False)
B = PISM.optionsFlag("-B", "description", default=None)
o.setValue("-no_C", "on")
C = PISM.optionsFlag("C", "description", default=None)
D = PISM.optionsFlag("D", "description", default=None)
D = PISM.optionsFlag("D", "description", default=True)
o.setValue("-no_D", "on")
o.setValue("-D", "on")
try:
# should throw RuntimeError
D = PISM.optionsFlag("D", "description", default=None)
return False
except RuntimeError:
pass
o.setValue("-IA", "1,2,3")
IA = PISM.optionsIntArray("-IA", "description", default=[1, 2])
IA = PISM.optionsIntArray("-IA", "description", default=None)
IA2 = PISM.optionsIntArray("-IA2", "description", default=None)
IA2 = PISM.optionsIntArray("-IA2", "description", default=[1, 2])
o.setValue("-RA", "1,2,3")
RA = PISM.optionsRealArray("-RA", "description", default=[2, 3])
RA = PISM.optionsRealArray("-RA", "description", default=None)
RA2 = PISM.optionsRealArray("-RA2", "description", default=[2, 3])
RA2 = PISM.optionsRealArray("-RA2", "description", default=None)
o.setValue("-SA", "1,2,3")
SA = PISM.optionsStringArray("-SA", "description", default="one,two")
SA = PISM.optionsStringArray("-SA", "description", default=None)
SA2 = PISM.optionsStringArray("-SA2", "description", default="two,three")
SA2 = PISM.optionsStringArray("-SA2", "description", default=None)
M = PISM.optionsList("-L", "description", choices="one,two", default="one")
M = PISM.optionsList("-L", "description", choices="one,two", default=None)