wolfhece.hydrology.forcedexchanges

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

class wolfhece.hydrology.forcedexchanges.forced_exchanges(workingdir='', fname='', mapviewer=None)[source]

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.

mapviewer = None[source]
_workingdir[source]
_color_up = (0, 238, 0)[source]
_color_down = (255, 52, 179)[source]
type = 'COORDINATES'[source]
_mycloudup[source]
_myclouddown[source]
_mysegs[source]
_myzone[source]
_filename[source]
is_empty()[source]

Check if the forced exchanges are empty.

property pairs[source]

Get the list of pairs of vertices.

property temporary_vector[source]

Get the temporary vector used for forced exchanges.

property color_up_integer[source]

Get the color of the upper vertices as an integer.

property color_down_integer[source]

Get the color of the lower vertices as an integer.

property color_up_rgb[source]

Get the color of the upper vertices as an RGB tuple.

property color_down_rgb[source]

Get the color of the lower vertices as an RGB tuple.

_read_file()[source]

Read the forced exchanges from a file.

_save_file()[source]

Save the forced exchanges to a file.

save()[source]

Save the forced exchanges to the file.

add_pair_dict(pair: dict)[source]

Add a pair of vertices to the forced exchanges from a dictionary.

Parameters:

pair (dict) – A dictionary with ‘up’ and ‘down’ keys containing the vertices.

add_pair_XY(x1, y1, x2, y2, reset_ogl: bool = False)[source]

Add a pair of coordinates to the forced exchanges.

add_pairs_XY(ups: list[list[float, float]], downs: list[float, float])[source]

Add multiple upstreams to one downstream as forced exchanges.

Parameters:
  • ups (list[list[float, float]]) – A list of lists containing the coordinates of the upstream vertices.

  • downs – A pair containing the coordinates of the downstream vertex.

add_pair(vertex_up, vertex_down)[source]

Add a pair of vertices to the forced exchanges.

reset_listogl()[source]

Reset the OpenGL lists for the forced exchanges.

_find_nearest_pair(x, y)[source]

Find the nearest pair of vertices to the given coordinates.

get_nearest_pair(x: float, y: float) dict[source]

Get the nearest pair of vertices to the given coordinates.

Returns:

A dictionary with ‘up’ and ‘down’ keys containing the nearest vertices.

Return type:

dict

get_nearest_pair_as_vector(x: float, y: float) wolfhece.PyVertexvectors.vector[source]

Get the nearest pair of vertices as a vector.

_find_nearest_pair_index(x, y)[source]

Find the index of the nearest pair of vertices to the given coordinates.

remove_nearest_pair(x, y)[source]

Remove the nearest pair of vertices to the given coordinates.

remove_nearest_pairs(xy: list[list[float, float]])[source]

Remove the nearest pairs of vertices to the given coordinates.

remove_pairs_inside_vector(vec: wolfhece.PyVertexvectors.vector)[source]

Remove pairs of vertices that are inside the given vector.

Parameters:

vec (vector) – The vector to check against.

_find_first_available_name()[source]

Find the first available name for a new forced exchange.

paint()[source]
reset()[source]

Reset the forced exchanges.