wolfhece.coupling.hydrology_2d

Author: HECE - University of Liege, Pierre Archambeau 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.coupling.hydrology_2d.InjectionType[source]

Bases: enum.Enum

Inheritance diagram of wolfhece.coupling.hydrology_2d.InjectionType

Generic enumeration.

Derive from this class to define new enumerations.

GLOBAL = 'Global'[source]
PARTIAL = 'Partial'[source]
ANTHROPOGENIC = 'Anthropogenic'[source]
CONSTANT = 'Constant'[source]
VIRTUAL = 'Virtual'[source]
class wolfhece.coupling.hydrology_2d.Searching_Context(river_axis: wolfhece.PyVertexvectors.vector, kdtree: scipy.spatial.KDTree, nodes: wolfhece.hydrology.PyWatershed.Node_Watershed, downstream_reaches: list[int], up_node: wolfhece.hydrology.PyWatershed.Node_Watershed)[source]
class wolfhece.coupling.hydrology_2d.Scaled_Infiltration(idx: int, type: InjectionType, colref: str, factor: float, lagtime: float)[source]
class wolfhece.coupling.hydrology_2d.Coupling_Hydrology_2D[source]
property number_of_injections: int[source]
property number_of_nodes_per_zone: dict[int, int][source]

Return the number of nodes per zone

property along: list[str, str][source]
property locales: list[str][source]
property watershed: wolfhece.hydrology.PyWatershed.Watershed[source]
property river_system: wolfhece.hydrology.PyWatershed.RiverSystem[source]
property subs_array: wolfhece.wolf_array.WolfArray[source]
plot_number_of_nodes_per_zone() tuple[matplotlib.figure.Figure, matplotlib.axes.Axes][source]

Plot the number of nodes per zone

set_array_to_coupling(array: wolfhece.wolf_array.WolfArray | pathlib.Path) None[source]

Set the array to coupling

Parameters:

array – The array to coupling

_create_infiltration_array()[source]

Create the infiltration array

add_hydrology_model(name: str, filename: str | pathlib.Path) None[source]

Add a hydrology model to the coupling

Parameters:

filename – The filename of the hydrology model

get_anthropogenic_names() list[str][source]

Print the names of the anthropogenic hydrographs

get_names_areas() list[str][source]

Print the names of the areas

create_hydrographs_local_global(unit_discharge: float, total_duration: float, anth_discharge: dict = None) None[source]

Create the hydrographs from the hydrology model .

Global and local hydrographs are created based on a unit discharge and a total duration.

You can also add anthropogenic hydrographs from a dictionary. The key is the name of the anthropogenic hydrograph and the value is the discharge. The keys can be obtained with the method get_anthropogenic_names.

Parameters:
  • unit_discharge – The discharge per square kilometer [m³/s/km²]

  • total_duration – The total duration of the hydrographs [s]

save_hydrographs(directory: str | pathlib.Path = None, total: str = None, partial: str = None) None[source]

Write the hydrographs from the hydrology model

load_hydrographs(directory: str | pathlib.Path = None, total: str = None, partial: str = None) None[source]

Load the hydrographs from the hydrology model

Parameters:
  • directory – The directory of the hydrology model – If None, the working directory of the loaded hydrology model is used

  • total – The filename of the total hydrographs - If None, the default filename is used

  • partial – The filename of the partial hydrographs - If None, the default filename is used

print_hydrographs(total: bool = True, partial: bool = True) None[source]

Print the hydrographs from the hydrology model

plot_hydrographs(total: bool = True, partial: bool = True) tuple[tuple[matplotlib.figure.Figure, matplotlib.axes.Axes], tuple[matplotlib.figure.Figure, matplotlib.axes.Axes]][source]

Plot the hydrographs from the hydrology model

add_virtual_hydrograph(name: str, src_hydrograph_name: str, factor: float, lag: float = 0.0)[source]

Add a virtual hydrograph to the hydrology model

add_river(filename: str | pathlib.Path) None[source]

Add a river to the hydrology model

Parameters:

filename – The filename of the river

reset() None[source]

Reset the hydrology model

add_locale_injections(filename: str | pathlib.Path) None[source]

Add a local injection to the hydrology model

Parameters:

filename – The filename of the local injection

find_river_axis()[source]

Find the river axis from Zones

_add_injection(name: str, vect: wolfhece.PyVertexvectors.vector)[source]

Add an injection to the hydrology model

Parameters:
  • name – The name of the injection

  • vect – The vector of the injection

find_injections()[source]

Find the injection points from Zones

find_rivers_upstream()[source]

Find the upstreams of the rivers

_find_upstream(curvect: wolfhece.PyVertexvectors.vector) wolfhece.PyVertexvectors.wolfvertex[source]

Find the upstream of a vector

Parameters:

curvect – The river’s axis

Prepare the search for the hydrology model.

The order is important because the reaches will be progressively excluded from the search for the next ones.

So, you have to start with the main river and then the tributaries.

Parameters:

rivers – The list of rivers to prepare

_is_global(col_name: str)[source]

Vérifie si la colonne est un hydrogramme global

_is_partial(col_name: str)[source]

Vérifie si la colonne est un hydrogramme partiel

_is_anthropic(col_name: str)[source]

Vérifie si la colonne est un hydrogramme anthropique (c’est-à-dire une colonne de l’hydrogramme total qui n’est pas un hydrogramme partiel)

_is_virtual(col_name: str)[source]

Vérifie si la colonne est un hydrogramme virtuel

_add_infil(type_name: InjectionType, col_name_q: str | float, factor: float, lag: float, index_zone: int = None)[source]

Ajoute une infiltration à la liste des infiltrations

Parameters:
  • type_name – nom du type d’infiltration

  • col_name – nom de la colonne de l’hydrogramme

  • factor – facteur multiplicatif

  • lag – déphasage

_add_local_injecton(local_vect: wolfhece.PyVertexvectors.vector, type_name: InjectionType, col_name: str, factor: float, lag: float)[source]

Ajoute une injection locale à la liste des infiltrations et remplissage de la matrice d’infiltration

Parameters:
  • local_vect – vecteur de la zone d’injection

  • type_name – nom du type d’injection

  • col_name – nom de la colonne de l’hydrogramme

  • factor – facteur multiplicatif

  • lag – déphasage

_add_along_injection(list_part: list[float, float], type_name: InjectionType, col_name: str, factor: float, lag: float)[source]

Ajoute une injection le long de la rivière et remplissage de la matrice d’infiltration

Parameters:
  • list_part – liste des coordonnées des points de la rivière

  • type_name – nom du type d’injection

  • col_name – nom de la colonne de l’hydrogramme

  • factor – facteur multiplicatif

  • lag – déphasage

write_infil_array(dirout: pathlib.Path)[source]

Sauvegarde de la matrice d’infiltration

_get_reaches_in_sub(subbasin: wolfhece.hydrology.PyWatershed.SubWatershed, rivers_names: list[str]) list[list[int]][source]

Retourne une liste de listes des biefs dans le sous-bassin

Parameters:

rivers – liste des noms des rivières

Returns:

liste des biefs dans le sous-bassin

_get_outlet_reaches(subbasin: wolfhece.hydrology.PyWatershed.SubWatershed, idx_reaches: list[int]) wolfhece.hydrology.PyWatershed.Node_Watershed[source]

Retourne le noeud de sortie du sous-bassin

Parameters:

reaches – liste des biefs dans le sous-bassin

Returns:

noeud de sortie du sous-bassin

_split_subwatershed(subbasin: wolfhece.hydrology.PyWatershed.SubWatershed, river_names: list[str, list[str]])[source]
_split_hydrographs(subbasin: wolfhece.hydrology.PyWatershed.SubWatershed | str, river_names: list[str, list[str]])[source]

Séparation de l’hydrogramme partiel en fonction des surfaces drainées par chaque rivère

On attend au maximum 2 rivières ou 1 rivière et une liste de rivières.

Les rivières seront traitées 2 par 2 de façon récursive.

La seconde rivière et l’affluent de la première rivière.

get_locale_injection_names()[source]

Print the names of the local injections

get_along_injection_names() tuple[list[str], list[str]][source]

Get the names of the along injections

Returns:

The names of the rivers along which the injections are made and the columns of the hydrographs

reset_injections()[source]

Reset the injections

spread_infiltrations()[source]

Traite les injections

injections_locales(couplings: list[tuple[str, str, InjectionType]] = None)[source]

Ajoute les injections locales

Searching cells in dem associated to the river nodes in the hydrological model.

We use the river axis to select the cells in the dem.

Then we search the nearest river nodes in the hydrological model.

We create local lists of cells associated to one river node.

Due to the fact that the river axis is not exactly the same as the river nodes (not the same spatial resolution, rester vs vector), all river nodes in the hydrological model are not necessarely associated to cells in the dem.

injections_along(along: list[str, str] = None)[source]

Injections along rivers

_injection_along(name_subwatershed_river: tuple[str, str])[source]
create_hydrographs()[source]

Création des hydrogrammes

Les étapes précédentes ont ajouté à la liste “infiltrations” les éléments suivants:

  • l’index de la zone d’infiltration (1-based)

  • l’hydrogramme de référence

  • la fecteur pondérateur

  • le temps de déphasage

Une zone peut contenir plusieurs apports.

Il faut donc parcourir l’ensemble des zones et sommer les contributions.

Le fichier final est ordonné comme la matrice d’infiltration.

Avant de sommer, il faut tout d’abord créer les hydrogrammes associés au BV virtuels (décomposition d’un BV, modélisé comme un tout, en plusieurs rivières distinctes pour la répartition en long)

save_hydrographs(dirout: pathlib.Path, name: str)[source]

Write the hydrographs