當前位置: 首頁>>代碼示例>>Python>>正文


Python EnvBase.get_value方法代碼示例

本文整理匯總了Python中CIME.XML.env_base.EnvBase.get_value方法的典型用法代碼示例。如果您正苦於以下問題:Python EnvBase.get_value方法的具體用法?Python EnvBase.get_value怎麽用?Python EnvBase.get_value使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CIME.XML.env_base.EnvBase的用法示例。


在下文中一共展示了EnvBase.get_value方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_value

# 需要導入模塊: from CIME.XML.env_base import EnvBase [as 別名]
# 或者: from CIME.XML.env_base.EnvBase import get_value [as 別名]
 def get_value(self, vid, attribute=None, resolved=True, subgroup=None):
     value = EnvBase.get_value(self, vid, attribute, resolved, subgroup)
     if value is None:
         tnode = self.get_optional_child("test")
         if tnode is not None:
             value = self.get_element_text(vid, root=tnode)
     return value
開發者ID:fischer-ncar,項目名稱:cime,代碼行數:9,代碼來源:env_test.py

示例2: get_value

# 需要導入模塊: from CIME.XML.env_base import EnvBase [as 別名]
# 或者: from CIME.XML.env_base.EnvBase import get_value [as 別名]
    def get_value(self, item, attribute=None, resolved=True, subgroup="case.run"):
        """
        Must default subgroup to something in order to provide single return value
        """
        value = None
        if subgroup is None:
            node = self.get_optional_node(item, attribute)
            if node is not None:
                value = node.text
                if resolved:
                    value = self.get_resolved_value(value)
            else:
                value = EnvBase.get_value(self,item,attribute,resolved)
        else:
            job_node = self.get_optional_node("job", {"name":subgroup})
            if job_node is not None:
                node = self.get_optional_node("entry", {"id":item}, root=job_node)
                if node is not None:
                    value = node.get("value")
                    if resolved:
                        value = self.get_resolved_value(value)

                    # Return value as right type if we were able to fully resolve
                    # otherwise, we have to leave as string.
                    if "$" not in value:
                        type_str = self._get_type_info(node)
                        value = convert_to_type(value, type_str, item)
        return value
開發者ID:cacraigucar,項目名稱:cime-cacraig,代碼行數:30,代碼來源:env_batch.py

示例3: get_value

# 需要導入模塊: from CIME.XML.env_base import EnvBase [as 別名]
# 或者: from CIME.XML.env_base.EnvBase import get_value [as 別名]
    def get_value(self, item, attribute=None, resolved=True, subgroup="case.run"):
        """
        Must default subgroup to something in order to provide single return value
        """

        value = None
        if subgroup is None:
            node = self.get_optional_child(item, attribute)
            if node is not None:
                value = self.text(node)
                if resolved:
                    value = self.get_resolved_value(value)
            else:
                value = EnvBase.get_value(self,item,attribute,resolved)
        else:
            value = EnvBase.get_value(self, item, attribute=attribute, resolved=resolved, subgroup=subgroup)

        return value
開發者ID:Katetc,項目名稱:cime,代碼行數:20,代碼來源:env_batch.py

示例4: get_value

# 需要導入模塊: from CIME.XML.env_base import EnvBase [as 別名]
# 或者: from CIME.XML.env_base.EnvBase import get_value [as 別名]
 def get_value(self, vid, attribute={}, resolved=True, subgroup=None):
     value = EnvBase.get_value(self, vid, attribute, resolved, subgroup)
     if "NTASKS" in vid and value < 0:
         value = -1*value*self.get_value("PES_PER_NODE")
     if "NTHRDS" in vid and value < 0:
         value = -1*value*self.get_value("PES_PER_NODE")
     if "ROOTPE" in vid and value < 0:
         value = -1*value*self.get_value("PES_PER_NODE")
     return value
開發者ID:quantheory,項目名稱:cime,代碼行數:11,代碼來源:env_mach_pes.py

示例5: get_value

# 需要導入模塊: from CIME.XML.env_base import EnvBase [as 別名]
# 或者: from CIME.XML.env_base.EnvBase import get_value [as 別名]
    def get_value(self, item, attribute=None, resolved=True, subgroup="case.run"):
        """
        Must default subgroup to something in order to provide single return value
        """

        value = None
        if subgroup is None:
            nodes = self.get_nodes(item, attribute)
            if len(nodes) == 1:
                node = nodes[0]
                value = node.text
                if resolved:
                    value = self.get_resolved_value(value)
            elif not nodes:
                value = EnvBase.get_value(self,item,attribute,resolved)
        else:
            value = EnvBase.get_value(self, item, attribute=attribute, resolved=resolved, subgroup=subgroup)

        return value
開發者ID:apcraig,項目名稱:cime,代碼行數:21,代碼來源:env_batch.py

示例6: get_value

# 需要導入模塊: from CIME.XML.env_base import EnvBase [as 別名]
# 或者: from CIME.XML.env_base.EnvBase import get_value [as 別名]
    def get_value(self, vid, attribute=None, resolved=True, subgroup=None, pes_per_node=None): # pylint: disable=arguments-differ
        value = EnvBase.get_value(self, vid, attribute, resolved, subgroup)
        if "NTASKS" in vid or "ROOTPE" in vid and pes_per_node is None:
            pes_per_node = self.get_value("PES_PER_NODE")

            if "NTASKS" in vid and value < 0:
                value = -1*value*pes_per_node
            if "ROOTPE" in vid and value < 0:
                value = -1*value*pes_per_node
        return value
開發者ID:ekluzek,項目名稱:cime,代碼行數:12,代碼來源:env_mach_pes.py

示例7: get_value

# 需要導入模塊: from CIME.XML.env_base import EnvBase [as 別名]
# 或者: from CIME.XML.env_base.EnvBase import get_value [as 別名]
    def get_value(self, vid, attribute=None, resolved=True, subgroup=None, MAX_MPITASKS_PER_NODE=None): # pylint: disable=arguments-differ
        # Special variable NINST_MAX is used to determine the number of
        # drivers in multi-driver mode.
        if vid == "NINST_MAX":
            value = 1
            for comp in self._components:
                if comp != "CPL":
                    value = max(value, self.get_value("NINST_{}".format(comp)))
            return value

        value = EnvBase.get_value(self, vid, attribute, resolved, subgroup)

        if "NTASKS" in vid or "ROOTPE" in vid:
            if MAX_MPITASKS_PER_NODE is None:
                MAX_MPITASKS_PER_NODE = self.get_value("MAX_MPITASKS_PER_NODE")
            if value is not None and value < 0:
                value = -1*value*MAX_MPITASKS_PER_NODE

        return value
開發者ID:apcraig,項目名稱:cime,代碼行數:21,代碼來源:env_mach_pes.py

示例8: get_value

# 需要導入模塊: from CIME.XML.env_base import EnvBase [as 別名]
# 或者: from CIME.XML.env_base.EnvBase import get_value [as 別名]
    def get_value(self, vid, attribute=None, resolved=True, subgroup=None, max_mpitasks_per_node=None): # pylint: disable=arguments-differ
        # Special variable NINST_MAX is used to determine the number of
        # drivers in multi-driver mode.
        if vid == "NINST_MAX":
            # in the nuopc driver there is only a single NINST value
            value = 1
            for comp in self._components:
                if comp != "CPL":
                    value = max(value, self.get_value("NINST_{}".format(comp)))
            return value

        value = EnvBase.get_value(self, vid, attribute, resolved, subgroup)

        if "NTASKS" in vid or "ROOTPE" in vid:
            if max_mpitasks_per_node is None:
                max_mpitasks_per_node = self.get_value("MAX_MPITASKS_PER_NODE")
            if value is not None and value < 0:
                value = -1*value*max_mpitasks_per_node
        # in the nuopc driver there is only one NINST value
        # so that NINST_{comp} = NINST
        if "NINST_" in vid and value is None:
            value = self.get_value("NINST")
        return value
開發者ID:fischer-ncar,項目名稱:cime,代碼行數:25,代碼來源:env_mach_pes.py


注:本文中的CIME.XML.env_base.EnvBase.get_value方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。