model.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:WNTR 作者: USEPA 项目源码 文件源码
def add_reservoir(self, name, base_head=0.0, head_pattern=None, coordinates=None):
        """
        Adds a reservoir to the water network model.

        Parameters
        ----------
        name : string
            Name of the reservoir.
        base_head : float, optional
            Base head at the reservoir.
        head_pattern : string or Pattern
            Name of the head pattern or the actual Pattern object
        coordinates : tuple of floats, optional
            X-Y coordinates of the node location.

        """
        base_head = float(base_head)
        if head_pattern and isinstance(head_pattern, six.string_types):
            head_pattern = self.get_pattern(head_pattern)
        reservoir = Reservoir(name, base_head, head_pattern)
        self._nodes[name] = reservoir
        self._reservoirs[name] = reservoir
        self._graph.add_node(name)
        if coordinates is not None:
            self.set_node_coordinates(name, coordinates)
        nx.set_node_attributes(self._graph, name='type', values={name:'reservoir'})
        self._num_reservoirs += 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号