本文整理汇总了Python中CIME.XML.env_base.EnvBase.set_value方法的典型用法代码示例。如果您正苦于以下问题:Python EnvBase.set_value方法的具体用法?Python EnvBase.set_value怎么用?Python EnvBase.set_value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIME.XML.env_base.EnvBase
的用法示例。
在下文中一共展示了EnvBase.set_value方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_value
# 需要导入模块: from CIME.XML.env_base import EnvBase [as 别名]
# 或者: from CIME.XML.env_base.EnvBase import set_value [as 别名]
def set_value(self, vid, value, subgroup=None, ignore_type=False):
"""
check if vid is in test section of file
"""
newval = EnvBase.set_value(self, vid, value, subgroup, ignore_type)
if newval is None:
tnode = self.get_optional_child("test")
if tnode is not None:
newval = self.set_element_text(vid, value, root=tnode)
return newval
示例2: set_value
# 需要导入模块: from CIME.XML.env_base import EnvBase [as 别名]
# 或者: from CIME.XML.env_base.EnvBase import set_value [as 别名]
def set_value(self, vid, value, subgroup=None, ignore_type=False):
"""
Set the value of an entry-id field to value
Returns the value or None if not found
subgroup is ignored in the general routine and applied in specific methods
"""
if vid == "MULTI_DRIVER" and value:
ninst_max = self.get_value("NINST_MAX")
for comp in self._components:
if comp == "CPL":
continue
ninst = self.get_value("NINST_{}".format(comp))
expect(ninst == ninst_max,
"All components must have the same NINST value in multi_driver mode. NINST_{}={} shoud be {}".format(comp,ninst,ninst_max))
return EnvBase.set_value(self, vid, value, subgroup=subgroup, ignore_type=ignore_type)