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
Generic enumeration.
Derive from this class to define new enumerations.
- 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 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
- 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
- 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
- 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
- _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_upstream(curvect: wolfhece.PyVertexvectors.vector) wolfhece.PyVertexvectors.wolfvertex [source]
Find the upstream of a vector
- Parameters:
curvect – The river’s axis
- prepare_search(rivers: list[str] = None)[source]
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_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)
- _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
- _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_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
- injections_locales(couplings: list[tuple[str, str, InjectionType]] = None)[source]
Ajoute les injections locales
- link_area2nodes()[source]
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.
- 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)