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