wolfhece.hydrology.SubBasin

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.SubBasin.SubBasin(_dateBegin: datetime.datetime = None, _dateEnd: datetime.datetime = None, _deltaT: int = 0, _model=cst.measures, _workingDir: str = '', _hyeto: dict = {}, _x: float = 0.0, _y: float = 0.0, surfaceDrained: float = 0.0, _iD_interiorPoint: int = 1, _idSorted: int = 1, name: str = None, readHydro=True, _tz: int = 0, version: str = cst.VERSION_WOLFHYDRO)[source]
property outFlow: wolfhece.PyParams.np.ndarray[source]

The outFlow property.

property outFlowRaw[source]

The outFlow property.

property outFlow_global[source]

The outFlow global property. Returns the outFlow in the global time, i.e. the hydrograph to which the timeDelay is applied.

property outFlowRaw_global[source]

The outFlow global property. Returns the outFlow in the global time, i.e. the hydrograph to which the timeDelay is applied.

property cumul_rain: wolfhece.PyParams.np.array[source]
name: str[source]
iD: int[source]
iDSorted: int[source]
x: float[source]
y: float[source]
haveInlets: bool[source]
alreadyUsed: bool[source]
isLeveled: bool[source]
isActivated: bool[source]
time: wolfhece.PyParams.np.ndarray[source]
dateBegin: datetime.datetime[source]
dateEnd: datetime.datetime[source]
deltaT: datetime.timedelta[source]
tz: float[source]
model: int[source]
treated: bool[source]
myLevel: bool[source]
fileNameRead: str[source]
fileNameWrite: str[source]
myHydro: wolfhece.PyParams.np.ndarray[source]
intletsObj: dict[source]
inlets: wolfhece.PyParams.np.ndarray[source]
inletsRaw: wolfhece.PyParams.np.ndarray[source]
downstreamObj: dict[source]
_outFlow: dict[source]
myHyetoDict: dict[source]
myRain: wolfhece.PyParams.np.ndarray[source]
rain: wolfhece.PyParams.np.ndarray[source]
myEvap: wolfhece.PyParams.np.ndarray[source]
evap: wolfhece.PyParams.np.ndarray[source]
myTemp: wolfhece.PyParams.np.ndarray[source]
mainCharactDict: dict[source]
mainCharactDictWholeHydro: dict[source]
landuseDict: dict[source]
landuseHydroDict: dict[source]
surfaceDrained: float[source]
surfaceDrainedHydro: float[source]
timeDelay: float[source]
peakVal: float[source]
peakTime: datetime.datetime[source]
ptr_q_all: wolfhece.PyParams.np.ndarray[source]
transferParam: wolfhece.PyParams.Wolf_Param[source]
_version: float[source]
change_haveInlets()[source]

This procedure only increment the number of inlets of a subbasin

get_hydro(iDSorted, workingDir, fileNames=None, tzDelta=datetime.timedelta(hours=0))[source]
get_outFlow_noDelay(unit='m3/s')[source]

This function returns the total outlet of the basin and considers t0=0 at the outlet of the subbasin without considering timeDelay (the time of the real outlet of the whole potential catchment)

get_outFlowRaw_noDelay(unit='m3/s')[source]

This function returns the total raw outlet of the basin and considers t0=0 at the outlet of the subbasin without considering timeDelay (the time of the real outlet of the whole potential catchment)

get_inlets_noDelay(unit='m3/s')[source]

This function returns the total inlets of the basin and considers t0=0 at the outlet of the subbasin without considering timeDelay (the time of the real outlet of the whole potential catchment)

add_name(myName)[source]

this function add a name to the subasin

increment_level()[source]

This procedure increment the level in the Topo dictionary

set_level(level)[source]
add_inlet(toPoint, name='DEFAULT')[source]

This procedure link the inlets to the object

add_downstreamObj(toPoint, name='DEFAULT')[source]

This procedure link the downstream element to the object

compute_hydro()[source]

This procedure computes the total hydrograph and raw hydrograph of subbasin

The total hydrograph $q_{tot} is obtained with the formula:

[

q_{tot} = sum q_{ ext{inlets}} + q_{ ext{me}}$

]

, with $q_{ ext{me}}$ the hydrograph of the subbasin alone.

Internal variable changed: outFlowRaw, outFlow, inletsRaw CAUTION:

  • Discussion about the ceil or the floor for the timeDelay indice!!!

  • UPDATE 2023.1 now the outFlow are not delayed anymore !!!! -> IMPORTANT UPDATE

sum_inlets()[source]

Sum all the inlet hydrographs of a subbasin. Return an array of zeros otherwise.

Internal variable changed: self.inlets, self.inletsRaw

add_rain(workingDir, fileName=None, tzDelta=datetime.timedelta(hours=0))[source]

This procedure - reads: the time, rain in the rain file - saves: the rain of the subbasin, sum of the rain’s inlets - returns: the time array read. - Variables modified: self.rain, self.myRain

add_evap(workingDir, fileName=None, tzDelta=datetime.timedelta(hours=0))[source]

This procedure - reads: the time, evapotranspiration in the evap file - saves: the evapotranspiration of the subbasin, sum of the evapotranspiration’s inlets -> to correct with surface of the basin - returns: the time array read. - Variables modified: self.evap, self.myEvap

add_temp(workingDir, fileName=None, tzDelta=datetime.timedelta(hours=0))[source]

This procedure - reads: the time, mean temperature in a day in the Temp file - saves: the temperatures of the subbasin - returns: the time array read. - Variables modified: self.myTemp

read_dbfFile(fileName)[source]
add_hyeto(workingDir, hyetoDict)[source]

Add hyetographs to the subbasin TO DO: Adapt the code to find automatically the .dbf files. E.G. when data are read in NetCDF files.

plot(workingDir, plotRaw=False, axis='Hours', yAdd=[], yAddName=[], rangeData=[], deltaMajorTicks=12.0 * 3600.0, deltaMinorTicks=3600.0, tzPlot=0)[source]

This procedure plots: - the inlets: in color chosen randomly by matplotlib - the outlet: in black solid line - the raw outlet: in black dashed line

plot_myBasin(Measures=None, rangeData=[], yrangeRain=[], yrangeData=[], factor=1.5, graph_title='', withEvap=False, writeFile='', withCt=False, figure=None)[source]

This procedure plots its own hydrographs and hyetographs

plot_outlet(Measures=None, rangeData=[], yrangeRain=[], yrangeData=[], ylabel=[], addData=[], dt_addData=[], beginDates_addData=[], endDates_addData=[], label_addData=[], color_addData=[], factor=1.5, graph_title='', withEvap=False, writeFile='', withDelay=True, deltaMajorTicks=-1, deltaMinorTicks=-1, tzPlot=0, Measure_unit='m3/s', addTable=False, figure=None)[source]

This procedure plots its own hydrographs and hyetographs

create_histo(time, hyeto)[source]

Transform the hyeto data and its assiciated time in a histogram

read_myMainCharacteristics(workingDir: str, fileNameList: list = [])[source]

This procedure read the main characteristics of the subbasin and hydro subbasin TO COMPLETE …

get_flood(path='', check_coherence=False)[source]
get_Nash_Flood(measures, tMeasures, dateBegin=None, dateEnd=None, path='')[source]
get_outFlow(typeOutFlow: str = 'Net', unit: str = 'm3/s', whichOutFlow='', lag: float = 0.0)[source]
get_inlets(unit: str = 'm3/s', lag: float = 0.0)[source]
convert_data_global_to_local(dataGlob)[source]
compute_runnoff_Ct_coeffs(method=-1)[source]
plot_diff_cumulRain_with_lagtime(interval, lagTime, graph_title='', factor=1.5, writeDir='', lawNetRain=cst.tom_netRain_no, netRainParams={})[source]

@var interval interval to consider in the gliding sum [sec] @var lagTime time to skip before applyihng the current rain [sec]

find_outFlow_peak()[source]
get_outFlow_peak(noDelay=False)[source]
apply_stock_reservoir(Hs, Ts, curS0=0.0)[source]

This function returns the net rain vector after applying a storage reservoir. @var H_s max height of the reservoir [mm] @var T_s time to empty completely the reservoir [h]

unuse(mask=[])[source]
activate(effSubs: list = [], effSubsSort: list = [], mask: list = [], onlyItself: bool = False)[source]
reset_timeDelay(keepDelta=False, keepDeltaAll=False, upStreamTime=-1.0)[source]
add_timeDelay(deltaT=0.0, reset=False, resetAll=False)[source]
get_inletsName()[source]
get_timeDelays(timeDelays={})[source]
get_timeDelays_inlets()[source]
get_surface_proportions(show=True)[source]
init_timeDelay()[source]
get_value_outlet(wolfarray: wolfhece.wolf_array.WolfArray)[source]
get_iDSorted()[source]
save_timeDelay(changeTofMod=True)[source]
save_timeDelays()[source]
get_myHydro(unit: str = 'mm/h') wolfhece.PyParams.np.ndarray[source]
get_landuse_index_transform_default(landuseDict: dict = {}) dict[source]
get_landuse_index_transform(directory: str, landuseDict: dict = {}) dict[source]
read_landuses(fileName: str = '', onlySub: bool = True, landuseName: str = '', landuse_index_transform: str = '', toSave: bool = True) dict[source]
get_landuses(onlySub: bool = True) dict[source]
plot_landuses(onlySub: bool = True, figure=None, toShow=False, writeFile='')[source]
get_outFlow_names() list[source]
change_version(newVersion=None)[source]
get_version()[source]
update_upstream_hydro(level_min: int = 1, update_upstream: bool = True)[source]
update_hydro(update_upstream: bool = True, level_min: int = 1)[source]
get_outFlow_global(whichOutFlow='', typeOutFlow='Net')[source]
evaluate_Nash(measure, intervals: list[tuple[datetime.datetime]] = []) list[float][source]
get_peak(intervals: list[tuple[datetime.datetime]] = []) list[float][source]
collect_x_from_production() dict[str, wolfhece.PyParams.np.array][source]

This procedure is collecting all the time series fractions of each outflow of the hydrological production models written in Fortran

Returns:

A dictionary containing the fractions of each outflow.

Return type:

dict[str, np.array]

collect_fractions() dict[str, wolfhece.PyParams.np.array][source]

This procedure is collecting all the fractions of each outflow of the hydrological production models.

Returns:

A dictionary containing the fractions of each outflow.

Return type:

dict[str, np.array]

collect_all_internal_variables() dict[str, wolfhece.PyParams.np.array][source]

This procedure is collecting all internal variables of the hydrological production models.

Returns:

A dictionary containing the fractions of each outflow.

Return type:

dict[str, np.array]

activate_all_internal_variables()[source]

This procedure is activating all internal variables of all the hydrological modules.

collect_x_VHM() dict[str, wolfhece.PyParams.np.array][source]

This procedure is collecting all the fractions of each outflow of the VHM model.

Returns: - all_x: A dictionary containing the fractions of each outflow of the VHM model.

_collect_fractions_VHM(all_x: dict[str, wolfhece.PyParams.np.array]) dict[str, wolfhece.PyParams.np.array][source]

This procedure is collecting all the fractions of each outflow of the VHM model.

Returns: - all_f: A dictionary containing the fractions of each outflow of the VHM model.

collect_iv_VHM() dict[str, wolfhece.PyParams.np.array][source]

This procedure is collecting all internal variables of the VHM model in each module.

Returns: - all_iv: A dictionary containing all internal variables of the VHM model.

activate_all_iv_VHM()[source]

This procedure is activating all internal variables of the VHM model in each module.

collect_x_GR4() dict[str, wolfhece.PyParams.np.array][source]

This procedure is collecting the fractions of each outflow of the GR4 model.

Returns:

A dictionary containing all fractions of each outflow of the GR4 model.

Return type:

dict[str, np.array]

_collect_fractions_GR4(all_x: dict[str, wolfhece.PyParams.np.array]) dict[str, wolfhece.PyParams.np.array][source]

This procedure is collecting all the fractions of each outflow of the GR4 model.

Returns: - all_f: A dictionary containing the fractions of each outflow of the GR4 model.

collect_iv_GR4() dict[str, wolfhece.PyParams.np.array][source]

This procedure is collecting all internal variables of the GR4 model in each module.

Returns: - all_iv: A dictionary containing all internal variables of the GR4 model.

activate_all_iv_GR4()[source]

This procedure is activating all internal variables of the GR4 model in each module.

collect_x_2layers() dict[str, wolfhece.PyParams.np.array][source]

This procedure is collecting the fractions of each outflow of the 2 layers model.

Returns:

A dictionary containing the collected fractions of each outflow variables.

_collect_fractions_2layers(all_x: dict[str, wolfhece.PyParams.np.array]) dict[str, wolfhece.PyParams.np.array][source]

This procedure is collecting all the fractions of each outflow of the 2 layers model.

Returns: - all_f: A dictionary containing the fractions of each outflow of the 2 layers model.

collect_iv_2layers() dict[str, wolfhece.PyParams.np.array][source]

This procedure is collecting all internal variables of the 2 layers model in each module.

Returns: - all_iv: A dictionary containing the fractions all internal variables of the 2 layers model.

activate_all_iv_2layers()[source]

This procedure is activating all internal variables of the 2 layers model in each module.

collect_internal_variables(list_keys: list[str], files_per_keys: list[list[str]], group_name: str = 'Internal variables to save', param_name: str = 'simul_soil') dict[str, wolfhece.PyParams.np.array][source]

Collects all the internal variables of the 2 layers model.

Parameters: - list_keys (list[str]): List of keys representing the internal variables to collect. - files_per_keys (list[list[str]]): List of lists containing the file names associated with each key. - group_name (str, optional): Name of the group containing the internal variables to save. Default is “Internal variables to save”. - production_name (str, optional): Name of the production file. Default is “simul_soil”.

Returns: - dict[str,np.array]: A dictionary containing the collected internal variables, where the keys are the variable names and the values are numpy arrays.

activate_internal_variables(list_keys: list[str], group_name: str = 'Internal variables to save', param_name: str = 'simul_soil')[source]

Activates all the internal variables of the 2 layers model.

Parameters: - list_keys (list[str]): List of keys representing the internal variables to collect.

get_summary_fractions(summary: str = 'mean', all_f: dict = {}, interval: list[tuple[datetime.datetime, datetime.datetime]] = None) dict[str, wolfhece.PyParams.np.array][source]

This procedure is returning a summary of the fractions of the current module.

Parameters: - summary (str): The type of summary to return. - interval (list[datetime.datetime], optional): The interval of time to consider. Default is None.

Returns: - dict: A dictionary containing the summary of the fractions of the current module.

get_volume_fractions(all_f: dict = {}, interval: list[tuple[datetime.datetime, datetime.datetime]] = None) dict[str, wolfhece.PyParams.np.array][source]

This procedure is returning a summary of the fractions of the current module.

Parameters: - summary (str): The type of summary to return. - interval (list[datetime.datetime], optional): The interval of time to consider. Default is None.

Returns: - dict: A dictionary containing the summary of the fractions of the current module.

check_presence_of_iv()[source]

This procedure is checking the presence of internal variables in the current module.

get_all_Qtest(nb_atttempts=-1, typeOutFlow: str = 'Net', unit: str = 'm3/s', whichOutFlow='', lag: float = 0.0) wolfhece.PyParams.np.array[source]

This function returns the Qtest hydrograph of the current module.

Parameters: - which (str, optional): The type of hydrograph to return. Default is “Net”.

Returns: - np.array: The Qtest hydrograph of the current module.

plot_all_fractions(all_fractions: dict[str:np.array] = {}, figure=None, to_show: bool = False, writeDir: str = '', range_data: list[datetime.datetime] = []) None[source]
evaluate_objective_function(unit='mm/h') wolfhece.PyParams.np.ndarray[source]

This procedure is evaluating the objective function of the current module.

Returns: - np.ndarray: The objective function of the current module.

import_from_pandas_Series(data: wolfhece.PyParams.pd.Series, which='outFlow')[source]
export_to_pandas_Series(which='outFlow')[source]