wolfhece.PyHydrographs
Author: HECE - University of Liege, Pierre Archambeau, Utashi Ciraane Docile 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.PyHydrographs.Constants(*args, **kwds)[source]
Bases:
enum.Enum
Contain the constants used throughout the module.
- class wolfhece.PyHydrographs.Hydrograph(data=None, index=None, dtype=None, name=None, copy=None, file_path: str = '')[source]
Bases:
pandas.Series
A pandas series containing discharges (values) with their respective times of observation (indices).
@ The class is inherited which means all series method are available in this class escorted by a few other functions useful in the interaction with wolfhece tools.
- write_as_wolf_file(file_path: str, writing_method: Literal['continuous', 'stepwise'] = 'continuous', epsilon: float = 1.0)[source]
Write the hydrograph on the infiltration format of wolf models -> infil[n].tv file.
- read_from_wolf_file(file_path: str, separator: Literal[',', ';', '\t'] = Constants.SEPARATOR.value) dict[source]
Read a wolf file at the format infil[n].tv and return its data as a dictionnary where:
keys are times and,
values are discharges.
- class wolfhece.PyHydrographs.HydrOperations[source]
Contains the operations that can be performed on Hydrographs.
- substract_hydrograph(hydrograph1: Hydrograph, hydrograph2: Hydrograph) Hydrograph[source]
Substract two hydrographs and return the difference. The second hydrograph is substracted from the first.
Note
The Nan values in the difference are dropped to avoid
constraints of hydrographs index.
- Parameters:
hydrograph1 (Hydrograph) – The first hydrograph.
hydrograph2 (Hydrograph) – The second hydrograph.
- Returns:
The difference between the two hydrographs.
- Return type:
- add_hydrograph(hydrograph1: Hydrograph, hydrograph2: Hydrograph) Hydrograph[source]
Add two hydrographs and return the sum. The second hydrograph is added to the first.
Note
The Nan values in the sum are dropped to avoid
constraints of hydrographs index.
- Parameters:
hydrograph1 (Hydrograph) – The first hydrograph.
hydrograph2 (Hydrograph) – The second hydrograph.
- Returns:
The sum of the two hydrographs.
- Return type:
- add_list_of_hydrographs(hydrographs: list) Hydrograph[source]
Add a list of hydrographs and return the sum. The hydrographs are added one after the other to the first one.
Note
The Nan values in the sum are dropped to avoid
constraints of hydrographs index.
- Parameters:
hydrographs (list) – The list of hydrographs.
- Returns:
The sum of the hydrographs.
- Return type:
- substract_list_of_hydrographs(hydrographs: list) Hydrograph[source]
Substract a list of hydrographs and return the difference. The hydrographs are substracted one after the other from the first one.
Note
The Nan values in the difference are dropped to avoid
constraints of hydrographs index.
- Parameters:
hydrographs (list) – The list of hydrographs.
- Returns:
The difference between the hydrographs.
- Return type:
- static as_stepwise_Hydrograph(hydrograph: Hydrograph | pandas.Series, epsilon=1) Hydrograph[source]
Return a stepwise hydrograph from a given hydrograph.
The steps are made by shifting uniformly the time index by an epsilon value (default 1 is subtracted) while keeping the same discharge value. This is useful for harmonizing a hydrograph in a stepwise manner.
- Parameters:
hydrograph (Hydrograph or Pandas Series) – The hydrograph to be converted to stepwise format.
epsilon (int, optional) – The value subtracted from each index of the hydrograph (each timestep), defaults to 1
- Returns:
the stepwise hydrograph
- Return type:
- static find_conversion_factor_from_seconds(convert_to: Literal['weeks', 'days', 'hours', 'minutes', 'seconds'] = 'seconds') int[source]
Find the conversion factor of a given time format to seconds.
- Parameters:
convert_to (Literal['days', 'hours', 'minutes', 'seconds']) – The time format to convert to.
- Returns:
The conversion factor.
- Return type:
int
- create_one_matplolib_axis(time: float, convert_to: Literal['weeks', 'days', 'hours', 'minutes', 'seconds'] = 'seconds', figsize: tuple = (30, 5), ylabel: str = 'Discharge ($m^3$/s)', tick_spacing: int = 1, x_start: int = 0, x_end: int = None, ax=None) matplotlib.axes.Axes[source]
Create a matplotlib axis with a date format of the number of days passed as argument.