wolfhece.hydrology.forcedexchanges ================================== .. py:module:: wolfhece.hydrology.forcedexchanges .. autoapi-nested-parse:: Author: HECE - University of Liege, Pierre Archambeau, Christophe Dessers Date: 2024 Copyright (c) 2024 University of Liege. All rights reserved. This script and its content are protected by copyright law. Unauthorized copying or distribution of this file, via any medium, is strictly prohibited. Module Contents --------------- .. py:class:: forced_exchanges(workingdir='', fname='', mapviewer=None) Forced exchanges For Hydrological model. A forced exchange is a pair of vertices that are coupled together. The first vertex is the upper one, the second is the lower one. .. py:attribute:: mapviewer :value: None .. py:attribute:: _workingdir .. py:attribute:: _color_up :value: (0, 238, 0) .. py:attribute:: _color_down :value: (255, 52, 179) .. py:attribute:: type :value: 'COORDINATES' .. py:attribute:: _mycloudup .. py:attribute:: _myclouddown .. py:attribute:: _mysegs .. py:attribute:: _myzone .. py:attribute:: _filename .. py:method:: is_empty() Check if the forced exchanges are empty. .. py:property:: pairs Get the list of pairs of vertices. .. py:property:: temporary_vector Get the temporary vector used for forced exchanges. .. py:property:: color_up_integer Get the color of the upper vertices as an integer. .. py:property:: color_down_integer Get the color of the lower vertices as an integer. .. py:property:: color_up_rgb Get the color of the upper vertices as an RGB tuple. .. py:property:: color_down_rgb Get the color of the lower vertices as an RGB tuple. .. py:method:: _read_file() Read the forced exchanges from a file. .. py:method:: _save_file() Save the forced exchanges to a file. .. py:method:: save() Save the forced exchanges to the file. .. py:method:: add_pair_dict(pair: dict) Add a pair of vertices to the forced exchanges from a dictionary. :param pair: A dictionary with 'up' and 'down' keys containing the vertices. :type pair: dict .. py:method:: add_pair_XY(x1, y1, x2, y2, reset_ogl: bool = False) Add a pair of coordinates to the forced exchanges. .. py:method:: add_pairs_XY(ups: list[list[float, float]], downs: list[float, float]) Add multiple upstreams to one downstream as forced exchanges. :param ups: A list of lists containing the coordinates of the upstream vertices. :type ups: list[list[float, float]] :param downs: A pair containing the coordinates of the downstream vertex. .. py:method:: add_pair(vertex_up, vertex_down) Add a pair of vertices to the forced exchanges. .. py:method:: reset_listogl() Reset the OpenGL lists for the forced exchanges. .. py:method:: _find_nearest_pair(x, y) Find the nearest pair of vertices to the given coordinates. .. py:method:: get_nearest_pair(x: float, y: float) -> dict Get the nearest pair of vertices to the given coordinates. :return: A dictionary with 'up' and 'down' keys containing the nearest vertices. :rtype: dict .. py:method:: get_nearest_pair_as_vector(x: float, y: float) -> wolfhece.PyVertexvectors.vector Get the nearest pair of vertices as a vector. .. py:method:: _find_nearest_pair_index(x, y) Find the index of the nearest pair of vertices to the given coordinates. .. py:method:: remove_nearest_pair(x, y) Remove the nearest pair of vertices to the given coordinates. .. py:method:: remove_nearest_pairs(xy: list[list[float, float]]) Remove the nearest pairs of vertices to the given coordinates. .. py:method:: remove_pairs_inside_vector(vec: wolfhece.PyVertexvectors.vector) Remove pairs of vertices that are inside the given vector. :param vec: The vector to check against. :type vec: vector .. py:method:: _find_first_available_name() Find the first available name for a new forced exchange. .. py:method:: paint() .. py:method:: reset() Reset the forced exchanges.