HydPy-WQ (base model)

The HydPy-WQ base model provides features to implement small function-like submodels for calculating discharge based on information like the current water level.

Method Features

class hydpy.models.wq.wq_model.Model[source]

Bases: AdHocModel, SubmodelInterface

HydPy-WQ (base model).

The following interface methods are available to main models using the defined model as a submodel:
The following “additional methods” might be called by one or more of the other methods or are meant to be directly called by the user:
DOCNAME: DocName = ('WQ', 'base model')
OBSERVER_METHODS: ClassVar[tuple[type[Method], ...]] = ()
REUSABLE_METHODS: ClassVar[tuple[type[ReusableMethod], ...]] = ()
class hydpy.models.wq.wq_model.Calculate_Discharge_V1[source]

Bases: Method

Calculate the discharge based on the water depth given in m according to Brauer et al. (2014) and return it in mm/T.

Requires the control parameters:

ChannelDepth CrestHeight BankfullDischarge DischargeExponent

Requires the derived parameter:

CrestHeightRegularisation

Basic equation (discontinuous):
\[\begin{split}q = q_{max} \cdot \left( \frac{max(h-h_{max}, \ 0)}{h_{max}-h_{min}} \right)^x \\ \\ q = Discharge \\ q_{max} = BankfullDischarge \\ h = waterdepth \\ h_{max} = ChannelDepth \\ h_{min} = CrestHeight \\ x = DischargeExponent\end{split}\]

Examples:

>>> from hydpy.models.wq_walrus import *
>>> simulationstep("12h")
>>> parameterstep("1d")
>>> channeldepth(5.0)
>>> crestheight(2.0)
>>> bankfulldischarge(2.0)
>>> dischargeexponent(2.0)
>>> from hydpy import round_
>>> hs = 1.0, 1.9, 2.0, 2.1, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0

Without smoothing:

>>> crestheighttolerance(0.0)
>>> derived.crestheightregularisation.update()
>>> for h in hs:
...     round_([h, model.calculate_discharge_v1(h)])
1.0, 0.0
1.9, 0.0
2.0, 0.0
2.1, 0.001111
3.0, 0.111111
4.0, 0.444444
5.0, 1.0
6.0, 1.777778
7.0, 2.777778
8.0, 4.0

Without smooting:

>>> crestheighttolerance(0.1)
>>> derived.crestheightregularisation.update()
>>> for h in hs:
...     round_([h, model.calculate_discharge_v1(h)])
1.0, 0.0
1.9, 0.0
2.0, 0.00001
2.1, 0.001111
3.0, 0.111111
4.0, 0.444444
5.0, 1.0
6.0, 1.777778
7.0, 2.777778
8.0, 4.0
class hydpy.models.wq.wq_model.Calc_WaterDepth_V1[source]

Bases: Method

Calculate the water depth based on the current water level.

Required by the methods:

Use_WaterLevel_V1 Use_WaterLevel_V2

Requires the control parameter:

BottomLevels

Requires the factor sequence:

WaterLevel

Calculates the factor sequence:

WaterDepth

Basic equation:
\[WaterDepth = max(WaterLevel - BottomLevels_{\,0}, \ 0)\]

Examples:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(2)
>>> bottomlevels(2.0, 3.0)
>>> factors.waterlevel(6.0)
>>> model.calc_waterdepth_v1()
>>> factors.waterdepth
waterdepth(4.0)
>>> factors.waterlevel(1.0)
>>> model.calc_waterdepth_v1()
>>> factors.waterdepth
waterdepth(0.0)
class hydpy.models.wq.wq_model.Calc_WaterDepth_V2[source]

Bases: Method

Calculate the water depth based on the current wetted area.

Required by the method:

Use_WettedArea_V1

Requires the control parameters:

NmbTrapezes BottomWidths SideSlopes

Requires the derived parameters:

TrapezeHeights SlopeWidths TrapezeAreas

Requires the factor sequence:

WettedArea

Calculates the factor sequence:

WaterDepth

Basic equation:
\[\begin{split}WaterDepth = \begin{cases} a / w &|\ s = 0 \\ \left( \sqrt{4 \cdot s \cdot a + w^2} - w \right) / (2 \cdot s) &|\ s > 0 \\ \end{cases} \\ a = WettedArea \\ w = BottomWidth \\ s = SideSlope\end{split}\]

Examples:

One can understand Calc_WaterDepth_V2 as an inverse method of Calc_WettedAreas_V1 (and Calc_WettedArea_V1). Hence, the following convenience function allows the creation of examples that are directly comparable to those on method Calc_WettedAreas_V1:

>>> from hydpy import print_vector, round_
>>> def test(*wettedareas):
...     derived.trapezeheights.update()
...     derived.slopewidths.update()
...     derived.trapezeareas.update()
...     for a in wettedareas:
...         factors.wettedarea = a
...         model.calc_waterdepth_v2()
...         print_vector([a, factors.waterdepth.value])

The first example deals with identical rectangular trapezes. We pass different wetted areas to the test function. These are the sums of the wetted areas of the different trapeze ranges calculated in the first example on method Calc_WettedAreas_V1. As expected, method Calc_WaterDepth_V2 finds the water depths used as input data for this example. However, note that negative wetted areas result in zero water depths:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(3)
>>> bottomlevels(1.0, 2.0, 3.0)
>>> bottomwidths(2.0)
>>> sideslopes(0.0)
>>> factors.wettedarea = 0.0
>>> test(-0.5, 0.0, 1.0, 2.0, 4.0, 6.0, 9.0, 12.0, 15.0, 18.0)
-0.5, 0.0
0.0, 0.0
1.0, 0.5
2.0, 1.0
4.0, 1.5
6.0, 2.0
9.0, 2.5
12.0, 3.0
15.0, 3.5
18.0, 4.0

The second example deals with identical triangular trapezes and corresponds to the second example on method Calc_WettedAreas_V1:

>>> bottomlevels(1.0, 2.0, 3.0)
>>> bottomwidths(0.0)
>>> sideslopes(2.0)
>>> test(-0.5, 0.0, 0.5, 2.0, 4.5, 8.0, 12.5, 18.0, 24.5, 32.0)
-0.5, 0.0
0.0, 0.0
0.5, 0.5
2.0, 1.0
4.5, 1.5
8.0, 2.0
12.5, 2.5
18.0, 3.0
24.5, 3.5
32.0, 4.0

The third example deals with identical “complete” trapezes and corresponds to the third example on method Calc_WettedAreas_V1:

>>> bottomlevels(1.0, 2.0, 3.0)
>>> bottomwidths(2.0)
>>> sideslopes(2.0)
>>> test(-0.5, 0.0, 1.5, 4.0, 8.5, 14.0, 21.5, 30.0, 39.5, 50.0)
-0.5, 0.0
0.0, 0.0
1.5, 0.5
4.0, 1.0
8.5, 1.5
14.0, 2.0
21.5, 2.5
30.0, 3.0
39.5, 3.5
50.0, 4.0

The fourth example mixes three different geometries and corresponds to the fourth example on method Calc_WettedAreas_V1:

>>> bottomlevels(1.0, 3.0, 4.0)
>>> bottomwidths(2.0, 0.0, 2.0)
>>> sideslopes(0.0, 2.0, 2.0)
>>> test(-0.5, 0.0, 1.0, 2.0, 3.0, 4.0, 5.5, 8.0, 12.5, 18.0)
-0.5, 0.0
0.0, 0.0
1.0, 0.5
2.0, 1.0
3.0, 1.5
4.0, 2.0
5.5, 2.5
8.0, 3.0
12.5, 3.5
18.0, 4.0
class hydpy.models.wq.wq_model.Calc_WaterDepth_V3[source]

Bases: Method

Calculate the water depth based on the current water level.

Required by the method:

Use_WaterLevel_V3

Requires the control parameter:

Heights

Requires the factor sequence:

WaterLevel

Calculates the factor sequence:

WaterDepth

Basic equation:

Examples:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbwidths(2)
>>> heights(2.0, 3.0)
>>> factors.waterlevel(6.0)
>>> model.calc_waterdepth_v3()
>>> factors.waterdepth
waterdepth(4.0)
>>> factors.waterlevel(1.0)
>>> model.calc_waterdepth_v3()
>>> factors.waterdepth
waterdepth(0.0)
class hydpy.models.wq.wq_model.Calc_WaterLevel_V1[source]

Bases: Method

Calculate the water level based on the current water depth.

Required by the methods:

Use_WaterDepth_V1 Use_WaterDepth_V2 Use_WettedArea_V1

Requires the control parameter:

BottomLevels

Requires the factor sequence:

WaterDepth

Calculates the factor sequence:

WaterLevel

Basic equation:
\[WaterLevel = WaterDepth + BottomLevels_{\,0}\]

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(2)
>>> bottomlevels(2.0, 3.0)
>>> factors.waterdepth(4.0)
>>> model.calc_waterlevel_v1()
>>> factors.waterlevel
waterlevel(6.0)
class hydpy.models.wq.wq_model.Calc_WaterLevel_V2[source]

Bases: Method

Calculate the water level based on the current water depth.

Required by the method:

Use_WaterDepth_V3

Requires the control parameter:

Heights

Requires the factor sequence:

WaterDepth

Calculates the factor sequence:

WaterLevel

Basic equation:
\[WaterLevel = WaterDepth + Heights_0\]

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbwidths(2)
>>> heights(2.0, 3.0)
>>> factors.waterdepth(4.0)
>>> model.calc_waterlevel_v2()
>>> factors.waterlevel
waterlevel(6.0)
class hydpy.models.wq.wq_model.Calc_Index_Excess_Weight_V1[source]

Bases: Method

Calculate some aide sequences that help to ease other calculations.

Required by the methods:

Use_WaterDepth_V3 Use_WaterLevel_V3

Requires the control parameters:

NmbWidths Heights

Requires the factor sequence:

WaterLevel

Calculates the aide sequences:

Index Weight Excess

Basic equations:
\[\begin{split}E = L - H_i \\ w = E / (H_{i+1} - H_i) \\ \\ L = WaterLevel \\ H = Heights \\ i = Index \\ E = Excess \\ w = Weight\end{split}\]

Example:

Index corresponds to the measured height directly equal to or below the current height (and is zero if the current height is smaller than the lowest measured height). Excess corresponds to the difference between the actual and the indexed height. Weight serves as a linear weighting factor and grows from zero to one when increasing the current height from the next-lower to the next-upper height (and is nan in case there is no next-upper height):

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbwidths(3)
>>> heights(1.0, 5.0, 7.0)
>>> from hydpy import print_vector
>>> for waterlevel in range(10):
...     factors.waterlevel = waterlevel
...     model.calc_index_excess_weight_v1()
...     print_vector([waterlevel, aides.index.value, aides.excess.value,
...                   aides.weight.value])
0, 0.0, 0.0, 0.0
1, 0.0, 0.0, 0.0
2, 0.0, 1.0, 0.25
3, 0.0, 2.0, 0.5
4, 0.0, 3.0, 0.75
5, 1.0, 0.0, 0.0
6, 1.0, 1.0, 0.5
7, 2.0, 0.0, nan
8, 2.0, 1.0, nan
9, 2.0, 2.0, nan
class hydpy.models.wq.wq_model.Calc_WettedAreas_V1[source]

Bases: Method

Calculate the wetted area for each trapeze range.

Required by the methods:

Use_WaterDepth_V1 Use_WaterDepth_V2 Use_WaterLevel_V1 Use_WaterLevel_V2 Use_WettedArea_V1

Requires the control parameters:

NmbTrapezes BottomWidths SideSlopes

Requires the derived parameters:

BottomDepths TrapezeHeights SlopeWidths

Requires the factor sequence:

WaterDepth

Calculates the factor sequence:

WettedAreas

Basic equation:
\[\begin{split}WettedAreas_i = \begin{cases} 0 &|\ d < 0 \\ (W_B + S_S\cdot d) \cdot d &|\ 0 \leq d < H_T \\ (W_B + W_S / 2) \cdot H_T + (W_B + W_S) \cdot (d - H_T) &|\ H_T \leq d \\ \end{cases} \\ \\ d = WaterDepth - BottomDepth_i \\ H_T = TrapezeHeights_i \\ W_B = BottomWidths_i \\ S_S = SideSlopes_i \\ W_S = SlopeWidths_i\end{split}\]

Examples:

The following convenience function executes Calc_WettedAreas_V1 for different water depths and prints the resulting wetted areas:

>>> from hydpy import print_vector, round_
>>> def test():
...     derived.bottomdepths.update()
...     derived.trapezeheights.update()
...     derived.slopewidths.update()
...     for d in [0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0]:
...         factors.waterdepth = d
...         model.calc_wettedareas_v1()
...         round_(d, end=": ")
...         print_vector(factors.wettedareas.values)

The first example deals with identical rectangular trapezes. There are no differences except those due to the different bottom levels:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(3)
>>> bottomlevels(1.0, 2.0, 3.0)
>>> bottomwidths(2.0)
>>> sideslopes(0.0)
>>> test()
0.0: 0.0, 0.0, 0.0
0.5: 1.0, 0.0, 0.0
1.0: 2.0, 0.0, 0.0
1.5: 3.0, 1.0, 0.0
2.0: 4.0, 2.0, 0.0
2.5: 5.0, 3.0, 1.0
3.0: 6.0, 4.0, 2.0
3.5: 7.0, 5.0, 3.0
4.0: 8.0, 6.0, 4.0

The second example deals with identical triangular trapezes. Here, the heights of the individual trapezes also matter because they mark where the triangular shape switches to a rectangular shape:

>>> bottomlevels(1.0, 2.0, 3.0)
>>> bottomwidths(0.0)
>>> sideslopes(2.0)
>>> test()
0.0: 0.0, 0.0, 0.0
0.5: 0.5, 0.0, 0.0
1.0: 2.0, 0.0, 0.0
1.5: 4.0, 0.5, 0.0
2.0: 6.0, 2.0, 0.0
2.5: 8.0, 4.0, 0.5
3.0: 10.0, 6.0, 2.0
3.5: 12.0, 8.0, 4.5
4.0: 14.0, 10.0, 8.0

The third example deals with identical “complete” trapezes by combining the first two geometries:

>>> bottomlevels(1.0, 2.0, 3.0)
>>> bottomwidths(2.0)
>>> sideslopes(2.0)
>>> test()
0.0: 0.0, 0.0, 0.0
0.5: 1.5, 0.0, 0.0
1.0: 4.0, 0.0, 0.0
1.5: 7.0, 1.5, 0.0
2.0: 10.0, 4.0, 0.0
2.5: 13.0, 7.0, 1.5
3.0: 16.0, 10.0, 4.0
3.5: 19.0, 13.0, 7.5
4.0: 22.0, 16.0, 12.0

The fourth example mixes three different geometries:

>>> bottomlevels(1.0, 3.0, 4.0)
>>> bottomwidths(2.0, 0.0, 2.0)
>>> sideslopes(0.0, 2.0, 2.0)
>>> test()
0.0: 0.0, 0.0, 0.0
0.5: 1.0, 0.0, 0.0
1.0: 2.0, 0.0, 0.0
1.5: 3.0, 0.0, 0.0
2.0: 4.0, 0.0, 0.0
2.5: 5.0, 0.5, 0.0
3.0: 6.0, 2.0, 0.0
3.5: 7.0, 4.0, 1.5
4.0: 8.0, 6.0, 4.0
class hydpy.models.wq.wq_model.Calc_FlowAreas_V1[source]

Bases: Method

Calculate the sector-specific wetted areas of those subareas of the cross section involved in water routing.

Required by the methods:

Use_WaterDepth_V3 Use_WaterLevel_V3

Requires the control parameter:

NmbSectors

Requires the derived parameters:

SectorFlowAreas SectorFlowWidths

Requires the factor sequence:

FlowWidths

Requires the aide sequences:

Index Excess

Calculates the factor sequence:

FlowAreas

Basic equation:
\[\begin{split}A = AS_i + E \cdot (SW_i + W) / 2 \\ \\ i = Index \\ E = Excess \\ A = FlowAreas \\ W = FlowWidths \\ AS = SectorFlowAreas \\ WS = SectorFlowWidths\end{split}\]

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbwidths(9)
>>> nmbsectors(4)
>>> heights(1.0, 3.0, 4.0, 4.0, 4.0, 5.0, 6.0, 7.0, 8.0)
>>> flowwidths(2.0, 4.0, 6.0, 14.0, 18.0, 18.0, 24.0, 28.0, 30.0)
>>> transitions(2, 3, 5)
>>> derived.sectorflowwidths.update()
>>> derived.sectorflowareas.update()
>>> from hydpy import print_vector
>>> for waterlevel in range(11):
...     factors.waterlevel = waterlevel
...     model.calc_index_excess_weight_v1()
...     model.calc_flowwidths_v1()
...     model.calc_flowareas_v1()
...     print_vector([waterlevel, *factors.flowareas.values])
0, 0.0, 0.0, 0.0, 0.0
1, 0.0, 0.0, 0.0, 0.0
2, 2.5, 0.0, 0.0, 0.0
3, 6.0, 0.0, 0.0, 0.0
4, 11.0, 0.0, 0.0, 0.0
5, 17.0, 8.0, 4.0, 0.0
6, 23.0, 16.0, 8.0, 3.0
7, 29.0, 24.0, 12.0, 11.0
8, 35.0, 32.0, 16.0, 22.0
9, 41.0, 40.0, 20.0, 34.0
10, 47.0, 48.0, 24.0, 46.0
class hydpy.models.wq.wq_model.Calc_TotalAreas_V1[source]

Bases: Method

Calculate the sector-specific wetted areas of the total cross section.

Required by the methods:

Use_WaterDepth_V3 Use_WaterLevel_V3

Requires the control parameter:

NmbSectors

Requires the derived parameters:

SectorTotalAreas SectorTotalWidths

Requires the factor sequence:

TotalWidths

Requires the aide sequences:

Index Excess

Calculates the factor sequence:

TotalAreas

Basic equation:
\[\begin{split}A = AS_i + E \cdot (SW_i + W) / 2 \\ \\ i = Index \\ E = Excess \\ A = TotalAreas \\ W = TotalWidths \\ AS = SectorTotalAreas \\ WS = SectorTotalWidths\end{split}\]

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbwidths(9)
>>> nmbsectors(4)
>>> heights(1.0, 3.0, 4.0, 4.0, 4.0, 5.0, 6.0, 7.0, 8.0)
>>> totalwidths(2.0, 4.0, 6.0, 14.0, 18.0, 18.0, 24.0, 28.0, 30.0)
>>> transitions(2, 3, 5)
>>> derived.sectortotalwidths.update()
>>> derived.sectortotalareas.update()
>>> from hydpy import print_vector
>>> for waterlevel in range(11):
...     factors.waterlevel = waterlevel
...     model.calc_index_excess_weight_v1()
...     model.calc_totalwidths_v1()
...     model.calc_totalareas_v1()
...     print_vector([waterlevel, *factors.totalareas.values])
0, 0.0, 0.0, 0.0, 0.0
1, 0.0, 0.0, 0.0, 0.0
2, 2.5, 0.0, 0.0, 0.0
3, 6.0, 0.0, 0.0, 0.0
4, 11.0, 0.0, 0.0, 0.0
5, 17.0, 8.0, 4.0, 0.0
6, 23.0, 16.0, 8.0, 3.0
7, 29.0, 24.0, 12.0, 11.0
8, 35.0, 32.0, 16.0, 22.0
9, 41.0, 40.0, 20.0, 34.0
10, 47.0, 48.0, 24.0, 46.0
class hydpy.models.wq.wq_model.Calc_WettedArea_V1[source]

Bases: Method

Sum up the individual trapeze ranges’ wetted areas.

Required by the methods:

Use_WaterDepth_V1 Use_WaterDepth_V2 Use_WaterLevel_V1 Use_WaterLevel_V2 Use_WettedArea_V1

Requires the control parameter:

NmbTrapezes

Requires the factor sequence:

WettedAreas

Calculates the factor sequence:

WettedArea

Basic equation:

\(WettedArea = \sum_{i=1}^{NmbTrapezes} WettedAreas_i\)

Examples:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(3)
>>> factors.wettedareas(2.0, 3.0, 1.0)
>>> model.calc_wettedarea_v1()
>>> factors.wettedarea
wettedarea(6.0)
class hydpy.models.wq.wq_model.Calc_FlowArea_V1[source]

Bases: Method

Sum up the individual cross-section sectors’ flow areas.

Required by the methods:

Use_WaterDepth_V3 Use_WaterLevel_V3

Requires the control parameter:

NmbSectors

Requires the factor sequence:

FlowAreas

Calculates the factor sequence:

FlowArea

Basic equation:

\(FlowArea = \sum_{i=1}^{NmbSectors} FlowAreas_i\)

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbsectors(3)
>>> factors.flowareas(2.0, 3.0, 1.0)
>>> model.calc_flowarea_v1()
>>> factors.flowarea
flowarea(6.0)
class hydpy.models.wq.wq_model.Calc_TotalArea_V1[source]

Bases: Method

Sum up the individual cross-section sectors’ total wetted areas.

Required by the methods:

Use_WaterDepth_V3 Use_WaterLevel_V3

Requires the control parameter:

NmbSectors

Requires the factor sequence:

TotalAreas

Calculates the factor sequence:

TotalArea

Basic equation:

\(TotalArea = \sum_{i=1}^{NmbSectors} TotalAreas_i\)

Examples:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbsectors(3)
>>> factors.totalareas(2.0, 3.0, 1.0)
>>> model.calc_totalarea_v1()
>>> factors.totalarea
totalarea(6.0)
class hydpy.models.wq.wq_model.Calc_WettedPerimeters_V1[source]

Bases: Method

Calculate the wetted perimeter for each trapeze range.

Required by the methods:

Use_WaterDepth_V1 Use_WaterDepth_V2 Use_WaterLevel_V1 Use_WaterLevel_V2 Use_WettedArea_V1

Requires the control parameters:

NmbTrapezes BottomWidths SideSlopes

Requires the derived parameters:

BottomDepths TrapezeHeights

Requires the factor sequence:

WaterDepth

Calculates the factor sequence:

WettedPerimeters

Basic equation:
\[\begin{split}WettedPerimeters_i = \begin{cases} 0 &|\ d < 0 \\ W_B + 2 \cdot d \cdot \sqrt{S_S^2 + 1} &|\ 0 \leq d < H_T \\ W_B + 2 \cdot H_T \cdot \sqrt{S_S^2 + 1} + 2 \cdot (d - H_T) &|\ H_T \leq d \\ \end{cases} \\ \\ d = WaterDepth - BottomDepth_i \\ H_T = TrapezeHeights_i \\ W_B = BottomWidths_i \\ S_S = SideSlopes_i\end{split}\]

Examples:

The following convenience function executes Calc_WettedPerimeters_V1 for different water depths and prints the resulting wetted perimeters:

>>> from hydpy import print_vector, round_
>>> def test():
...     derived.bottomdepths.update()
...     derived.trapezeheights.update()
...     for d in [0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0]:
...         factors.waterdepth = d
...         model.calc_wettedperimeters_v1()
...         round_(d, end=": ")
...         print_vector(factors.wettedperimeters.values)

The first example deals with identical rectangular trapezes. Note that method Calc_WettedPerimeters_V1 adds the contact surface between two adjacent trapeze ranges only to the wetted perimeter of the inner one:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(3)
>>> bottomlevels(1.0, 2.0, 3.0)
>>> bottomwidths(2.0)
>>> sideslopes(0.0)
>>> test()
0.0: 2.0, 0.0, 0.0
0.5: 3.0, 0.0, 0.0
1.0: 4.0, 2.0, 0.0
1.5: 5.0, 3.0, 0.0
2.0: 6.0, 4.0, 2.0
2.5: 7.0, 5.0, 3.0
3.0: 8.0, 6.0, 4.0
3.5: 9.0, 7.0, 5.0
4.0: 10.0, 8.0, 6.0

The second example deals with identical triangular trapezes. Here, the heights of the individual trapezes also matter because they mark where the triangular shape switches to a rectangular shape:

>>> bottomlevels(1.0, 2.0, 3.0)
>>> bottomwidths(0.0)
>>> sideslopes(2.0)
>>> test()
0.0: 0.0, 0.0, 0.0
0.5: 2.236068, 0.0, 0.0
1.0: 4.472136, 0.0, 0.0
1.5: 5.472136, 2.236068, 0.0
2.0: 6.472136, 4.472136, 0.0
2.5: 7.472136, 5.472136, 2.236068
3.0: 8.472136, 6.472136, 4.472136
3.5: 9.472136, 7.472136, 6.708204
4.0: 10.472136, 8.472136, 8.944272

The third example deals with identical “complete” trapezes by combining the first two geometries:

>>> bottomlevels(1.0, 2.0, 3.0)
>>> bottomwidths(2.0)
>>> sideslopes(2.0)
>>> test()
0.0: 2.0, 0.0, 0.0
0.5: 4.236068, 0.0, 0.0
1.0: 6.472136, 2.0, 0.0
1.5: 7.472136, 4.236068, 0.0
2.0: 8.472136, 6.472136, 2.0
2.5: 9.472136, 7.472136, 4.236068
3.0: 10.472136, 8.472136, 6.472136
3.5: 11.472136, 9.472136, 8.708204
4.0: 12.472136, 10.472136, 10.944272

The fourth example mixes three different geometries:

>>> bottomlevels(1.0, 3.0, 4.0)
>>> bottomwidths(2.0, 0.0, 2.0)
>>> sideslopes(0.0, 2.0, 2.0)
>>> test()
0.0: 2.0, 0.0, 0.0
0.5: 3.0, 0.0, 0.0
1.0: 4.0, 0.0, 0.0
1.5: 5.0, 0.0, 0.0
2.0: 6.0, 0.0, 0.0
2.5: 7.0, 2.236068, 0.0
3.0: 8.0, 4.472136, 2.0
3.5: 9.0, 5.472136, 4.236068
4.0: 10.0, 6.472136, 6.472136
class hydpy.models.wq.wq_model.Calc_FlowPerimeters_V1[source]

Bases: Method

Interpolate the sector-specific wetted perimeters of those subareas of the cross section involved in water routing.

Required by the methods:

Use_WaterDepth_V3 Use_WaterLevel_V3

Requires the control parameter:

NmbSectors

Requires the derived parameter:

SectorFlowPerimeters

Requires the aide sequences:

Index Weight Excess

Calculates the factor sequence:

FlowPerimeters

Basic equations:
\[\begin{split}P = \begin{cases} (1 - w) \cdot PS_i + w \cdot PS_{i+1} &|\ w \neq nan \\ PS_i + 2 \cdot E &|\ w = nan \end{cases} \\ \\ i = Index \\ w = Weight \\ E = Excess \\ P = FlowPerimeters \\ PS = SectorFlowPerimeters\end{split}\]

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbwidths(9)
>>> nmbsectors(4)
>>> heights(1.0, 3.0, 4.0, 4.0, 4.0, 5.0, 6.0, 7.0, 8.0)
>>> flowwidths(2.0, 4.0, 6.0, 14.0, 18.0, 18.0, 24.0, 28.0, 30.0)
>>> transitions(2, 3, 5)
>>> derived.sectorflowwidths.update()
>>> derived.sectorflowperimeters.update()
>>> from hydpy import print_vector
>>> for waterlevel in range(11):
...     factors.waterlevel = waterlevel
...     model.calc_index_excess_weight_v1()
...     model.calc_flowwidths_v1()
...     model.calc_flowperimeters_v1()
...     print_vector([waterlevel, *factors.flowperimeters.values])
0, 2.0, 0.0, 0.0, 0.0
1, 2.0, 0.0, 0.0, 0.0
2, 4.236068, 0.0, 0.0, 0.0
3, 6.472136, 0.0, 0.0, 0.0
4, 9.300563, 8.0, 4.0, 0.0
5, 11.300563, 10.0, 6.0, 0.0
6, 13.300563, 12.0, 8.0, 6.324555
7, 15.300563, 14.0, 10.0, 10.796691
8, 17.300563, 16.0, 12.0, 13.625118
9, 19.300563, 18.0, 14.0, 15.625118
10, 21.300563, 20.0, 16.0, 17.625118
class hydpy.models.wq.wq_model.Calc_WettedPerimeter_V1[source]

Bases: Method

Sum up the individual trapeze ranges’ wetted perimeters.

Required by the methods:

Use_WaterDepth_V2 Use_WaterLevel_V2 Use_WettedArea_V1

Requires the control parameter:

NmbTrapezes

Requires the factor sequence:

WettedPerimeters

Calculates the factor sequence:

WettedPerimeter

Basic equation:

\(WettedPerimeter = \sum_{i=1}^{NmbTrapezes} WettedPerimeters_i\)

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(3)
>>> factors.wettedperimeters(2.0, 3.0, 1.0)
>>> model.calc_wettedperimeter_v1()
>>> factors.wettedperimeter
wettedperimeter(6.0)
class hydpy.models.wq.wq_model.Calc_WettedPerimeterDerivatives_V1[source]

Bases: Method

Calculate the change in the wetted perimeter of each trapeze range with respect to the water level increase.

Required by the methods:

Use_WaterDepth_V1 Use_WaterLevel_V1

Requires the control parameter:

NmbTrapezes

Requires the derived parameters:

BottomDepths TrapezeHeights PerimeterDerivatives

Requires the factor sequence:

WaterDepth

Calculates the factor sequence:

WettedPerimeterDerivatives

Basic equation:
\[\begin{split}WettedPerimeterDerivatives_i = \begin{cases} 0 &|\ d < 0 \\ P' &|\ 0 \leq d < H_T \\ 2 &|\ H_T \leq d \\ \end{cases} \\ \\ d = WaterDepth - BottomDepth_i \\ H_T = TrapezeHeights_i \\ P' = PerimeterDerivatives_i\end{split}\]

Examples:

The following convenience function executes Calc_WettedPerimeterDerivatives_V1 for different water depths and prints the resulting wetted perimeters:

>>> from hydpy import print_vector, round_
>>> def test():
...     derived.bottomdepths.update()
...     derived.trapezeheights.update()
...     derived.perimeterderivatives.update()
...     for d in [0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0]:
...         factors.waterdepth = d
...         model.calc_wettedperimeterderivatives_v1()
...         round_(d, end=": ")
...         print_vector(factors.wettedperimeterderivatives.values)

The first example deals with identical rectangular trapezes. Note that method Calc_WettedPerimeterDerivatives_V1 adds the contact surface increase between two adjacent trapeze ranges only to the wetted perimeter derivative of the inner one:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(3)
>>> bottomlevels(1.0, 2.0, 3.0)
>>> bottomwidths(2.0)
>>> sideslopes(0.0)
>>> test()
0.0: 2.0, 0.0, 0.0
0.5: 2.0, 0.0, 0.0
1.0: 2.0, 2.0, 0.0
1.5: 2.0, 2.0, 0.0
2.0: 2.0, 2.0, 2.0
2.5: 2.0, 2.0, 2.0
3.0: 2.0, 2.0, 2.0
3.5: 2.0, 2.0, 2.0
4.0: 2.0, 2.0, 2.0

The second example deals with identical triangular trapezes. Here, the heights of the individual trapezes also matter because they mark where the triangular shape switches to a rectangular shape:

>>> bottomlevels(1.0, 2.0, 3.0)
>>> bottomwidths(0.0)
>>> sideslopes(2.0)
>>> test()
0.0: 4.472136, 0.0, 0.0
0.5: 4.472136, 0.0, 0.0
1.0: 2.0, 4.472136, 0.0
1.5: 2.0, 4.472136, 0.0
2.0: 2.0, 2.0, 4.472136
2.5: 2.0, 2.0, 4.472136
3.0: 2.0, 2.0, 4.472136
3.5: 2.0, 2.0, 4.472136
4.0: 2.0, 2.0, 4.472136

The third example deals with identical “complete” trapezes by combining the first two geometries:

>>> bottomlevels(1.0, 2.0, 3.0)
>>> bottomwidths(2.0)
>>> sideslopes(2.0)
>>> test()
0.0: 4.472136, 0.0, 0.0
0.5: 4.472136, 0.0, 0.0
1.0: 2.0, 4.472136, 0.0
1.5: 2.0, 4.472136, 0.0
2.0: 2.0, 2.0, 4.472136
2.5: 2.0, 2.0, 4.472136
3.0: 2.0, 2.0, 4.472136
3.5: 2.0, 2.0, 4.472136
4.0: 2.0, 2.0, 4.472136

The fourth example mixes three different geometries:

>>> bottomlevels(1.0, 3.0, 4.0)
>>> bottomwidths(2.0, 0.0, 2.0)
>>> sideslopes(0.0, 2.0, 2.0)
>>> test()
0.0: 2.0, 0.0, 0.0
0.5: 2.0, 0.0, 0.0
1.0: 2.0, 0.0, 0.0
1.5: 2.0, 0.0, 0.0
2.0: 2.0, 4.472136, 0.0
2.5: 2.0, 4.472136, 0.0
3.0: 2.0, 2.0, 4.472136
3.5: 2.0, 2.0, 4.472136
4.0: 2.0, 2.0, 4.472136
class hydpy.models.wq.wq_model.Calc_FlowPerimeterDerivatives_V1[source]

Bases: Method

Take the sector-specific wetted perimeter derivatives of those subareas of the cross section involved in water routing.

Required by the methods:

Use_WaterDepth_V3 Use_WaterLevel_V3

Requires the control parameter:

NmbSectors

Requires the derived parameter:

SectorFlowPerimeterDerivatives

Requires the aide sequence:

Index

Calculates the factor sequence:

FlowPerimeterDerivatives

Basic equations:
\[P = DS_i \ \ i = Index \ D = FlowPerimeterDerivatives \ DS = SectorFlowPerimeterDerivatives\]

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbwidths(9)
>>> nmbsectors(4)
>>> heights(1.0, 3.0, 4.0, 4.0, 4.0, 5.0, 6.0, 7.0, 8.0)
>>> flowwidths(2.0, 4.0, 6.0, 14.0, 18.0, 18.0, 24.0, 28.0, 30.0)
>>> transitions(2, 3, 5)
>>> derived.sectorflowwidths.update()
>>> derived.sectorflowperimeterderivatives.update()
>>> from hydpy import print_vector
>>> for waterlevel in range(11):
...     factors.waterlevel = waterlevel
...     model.calc_index_excess_weight_v1()
...     model.calc_flowperimeterderivatives_v1()
...     print_vector([waterlevel, *factors.flowperimeterderivatives.values])
0, 2.236068, nan, nan, nan
1, 2.236068, nan, nan, nan
2, 2.236068, nan, nan, nan
3, 2.828427, nan, nan, nan
4, 2.0, 2.0, 2.0, nan
5, 2.0, 2.0, 2.0, 6.324555
6, 2.0, 2.0, 2.0, 4.472136
7, 2.0, 2.0, 2.0, 2.828427
8, 2.0, 2.0, 2.0, 2.0
9, 2.0, 2.0, 2.0, 2.0
10, 2.0, 2.0, 2.0, 2.0
class hydpy.models.wq.wq_model.Calc_SurfaceWidths_V1[source]

Bases: Method

Calculate the surface width for each trapeze range.

Required by the methods:

Use_WaterDepth_V1 Use_WaterLevel_V1

Requires the control parameters:

NmbTrapezes BottomWidths SideSlopes

Requires the derived parameters:

BottomDepths TrapezeHeights SlopeWidths

Requires the factor sequence:

WaterDepth

Calculates the factor sequence:

SurfaceWidths

Basic equation:
\[\begin{split}SurfaceWidths_i = \begin{cases} 0 &|\ d < 0 \\ W_B + 2 \cdot S_S \cdot d &|\ 0 \leq d < H_T \\ W_B + W_S &|\ H_T \leq d \\ \end{cases} \\ \\ d = WaterDepth - BottomDepth_i \\ H_T = TrapezeHeights_i \\ W_B = BottomWidths_i \\ S_S = SideSlopes_i \\ W_S = SlopeWidth_i\end{split}\]

Example:

The following convenience function executes Calc_SurfaceWidths_V1 for different water depths and prints the surface widths:

>>> from hydpy import print_vector, round_
>>> def test():
...     derived.bottomdepths.update()
...     derived.trapezeheights.update()
...     derived.slopewidths.update()
...     for d in [0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0]:
...         factors.waterdepth = d
...         model.calc_surfacewidths_v1()
...         round_(d, end=": ")
...         print_vector(factors.surfacewidths.values)

The first example deals with identical rectangular trapezes. There are no differences except those due to the different bottom levels:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(3)
>>> bottomlevels(1.0, 2.0, 3.0)
>>> bottomwidths(2.0)
>>> sideslopes(0.0)
>>> test()
0.0: 2.0, 0.0, 0.0
0.5: 2.0, 0.0, 0.0
1.0: 2.0, 2.0, 0.0
1.5: 2.0, 2.0, 0.0
2.0: 2.0, 2.0, 2.0
2.5: 2.0, 2.0, 2.0
3.0: 2.0, 2.0, 2.0
3.5: 2.0, 2.0, 2.0
4.0: 2.0, 2.0, 2.0

The second example deals with identical triangular trapezes. Here, the heights of the individual trapezes also matter because they mark where the triangular shape switches to a rectangular shape:

>>> bottomlevels(1.0, 2.0, 3.0)
>>> bottomwidths(0.0)
>>> sideslopes(2.0)
>>> test()
0.0: 0.0, 0.0, 0.0
0.5: 2.0, 0.0, 0.0
1.0: 4.0, 0.0, 0.0
1.5: 4.0, 2.0, 0.0
2.0: 4.0, 4.0, 0.0
2.5: 4.0, 4.0, 2.0
3.0: 4.0, 4.0, 4.0
3.5: 4.0, 4.0, 6.0
4.0: 4.0, 4.0, 8.0

The third example deals with identical “complete” trapezes by combining the first two geometries:

>>> bottomlevels(1.0, 2.0, 3.0)
>>> bottomwidths(2.0)
>>> sideslopes(2.0)
>>> test()
0.0: 2.0, 0.0, 0.0
0.5: 4.0, 0.0, 0.0
1.0: 6.0, 2.0, 0.0
1.5: 6.0, 4.0, 0.0
2.0: 6.0, 6.0, 2.0
2.5: 6.0, 6.0, 4.0
3.0: 6.0, 6.0, 6.0
3.5: 6.0, 6.0, 8.0
4.0: 6.0, 6.0, 10.0

The fourth example mixes three different geometries:

>>> bottomlevels(1.0, 3.0, 4.0)
>>> bottomwidths(2.0, 0.0, 2.0)
>>> sideslopes(0.0, 2.0, 2.0)
>>> test()
0.0: 2.0, 0.0, 0.0
0.5: 2.0, 0.0, 0.0
1.0: 2.0, 0.0, 0.0
1.5: 2.0, 0.0, 0.0
2.0: 2.0, 0.0, 0.0
2.5: 2.0, 2.0, 0.0
3.0: 2.0, 4.0, 2.0
3.5: 2.0, 4.0, 4.0
4.0: 2.0, 4.0, 6.0
class hydpy.models.wq.wq_model.Calc_SurfaceWidth_V1[source]

Bases: Method

Sum the individual trapeze ranges’ surface widths.

Required by the methods:

Use_WaterDepth_V1 Use_WaterLevel_V1

Requires the control parameter:

NmbTrapezes

Requires the factor sequence:

SurfaceWidths

Calculates the factor sequence:

SurfaceWidth

Basic equation:

\(SurfaceWidth = \sum_{i=1}^{NmbTrapezes} SurfaceWidths_i\)

Examples:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(3)
>>> factors.surfacewidths(2.0, 3.0, 1.0)
>>> model.calc_surfacewidth_v1()
>>> factors.surfacewidth
surfacewidth(6.0)
class hydpy.models.wq.wq_model.Calc_FlowWidths_V1[source]

Bases: Method

Interpolate the sector-specific widths of those subareas of the cross section involved in water routing.

Required by the methods:

Use_WaterDepth_V3 Use_WaterLevel_V3

Requires the control parameter:

NmbSectors

Requires the derived parameter:

SectorFlowWidths

Requires the aide sequences:

Index Weight

Calculates the factor sequence:

FlowWidths

Basic equation:
\[\begin{split}W_i = \begin{cases} (1 - w) \cdot WS_i + w \cdot WS_{i+1} &|\ w \neq nan \\ WS_i &|\ w = nan \end{cases} \\ \\ i = Index \\ w = Weight \\ W = FlowWidths \\ WS = SectorFlowWidths\end{split}\]

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbwidths(9)
>>> nmbsectors(4)
>>> heights(1.0, 3.0, 4.0, 4.0, 4.0, 5.0, 6.0, 7.0, 8.0)
>>> flowwidths(2.0, 4.0, 6.0, 14.0, 18.0, 18.0, 24.0, 28.0, 30.0)
>>> transitions(2, 3, 5)
>>> derived.sectorflowwidths.update()
>>> from hydpy import print_vector
>>> for waterlevel in range(11):
...     factors.waterlevel = waterlevel
...     model.calc_index_excess_weight_v1()
...     model.calc_flowwidths_v1()
...     print_vector([waterlevel, *factors.flowwidths.values])
0, 2.0, 0.0, 0.0, 0.0
1, 2.0, 0.0, 0.0, 0.0
2, 3.0, 0.0, 0.0, 0.0
3, 4.0, 0.0, 0.0, 0.0
4, 6.0, 8.0, 4.0, 0.0
5, 6.0, 8.0, 4.0, 0.0
6, 6.0, 8.0, 4.0, 6.0
7, 6.0, 8.0, 4.0, 10.0
8, 6.0, 8.0, 4.0, 12.0
9, 6.0, 8.0, 4.0, 12.0
10, 6.0, 8.0, 4.0, 12.0
class hydpy.models.wq.wq_model.Calc_TotalWidths_V1[source]

Bases: Method

Interpolate the sector-specific widths of the total cross section.

Required by the methods:

Use_WaterDepth_V3 Use_WaterLevel_V3

Requires the control parameter:

NmbSectors

Requires the derived parameter:

SectorTotalWidths

Requires the aide sequences:

Index Weight

Calculates the factor sequence:

TotalWidths

Basic equation:
\[\begin{split}W_i = \begin{cases} (1 - w) \cdot WS_i + w \cdot WS_{i+1} &|\ w \neq nan \\ WS_i &|\ w = nan \end{cases} \\ \\ i = Index \\ w = Weight \\ W = TotalWidths \\ WS = SectorTotalWidths\end{split}\]

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbwidths(9)
>>> nmbsectors(4)
>>> heights(1.0, 3.0, 4.0, 4.0, 4.0, 5.0, 6.0, 7.0, 8.0)
>>> totalwidths(2.0, 4.0, 6.0, 14.0, 18.0, 18.0, 24.0, 28.0, 30.0)
>>> transitions(2, 3, 5)
>>> derived.sectortotalwidths.update()
>>> from hydpy import print_vector
>>> for waterlevel in range(11):
...     factors.waterlevel = waterlevel
...     model.calc_index_excess_weight_v1()
...     model.calc_totalwidths_v1()
...     print_vector([waterlevel, *factors.totalwidths.values])
0, 2.0, 0.0, 0.0, 0.0
1, 2.0, 0.0, 0.0, 0.0
2, 3.0, 0.0, 0.0, 0.0
3, 4.0, 0.0, 0.0, 0.0
4, 6.0, 8.0, 4.0, 0.0
5, 6.0, 8.0, 4.0, 0.0
6, 6.0, 8.0, 4.0, 6.0
7, 6.0, 8.0, 4.0, 10.0
8, 6.0, 8.0, 4.0, 12.0
9, 6.0, 8.0, 4.0, 12.0
10, 6.0, 8.0, 4.0, 12.0
class hydpy.models.wq.wq_model.Calc_TotalWidth_V1[source]

Bases: Method

Sum the individual cross-section sectors’ water surface widths.

Required by the methods:

Use_WaterDepth_V3 Use_WaterLevel_V3

Requires the control parameter:

NmbSectors

Requires the factor sequence:

TotalWidths

Calculates the factor sequence:

TotalWidth

Basic equation:

\(TotalWidth = \sum_{i=1}^{NmbSectors} TotalWidths_i\)

Examples:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbsectors(3)
>>> factors.totalwidths(2.0, 3.0, 1.0)
>>> model.calc_totalwidth_v1()
>>> factors.totalwidth
totalwidth(6.0)
class hydpy.models.wq.wq_model.Calc_Discharges_V1[source]

Bases: Method

Calculate the discharge for each trapeze range.

Required by the methods:

Use_WaterDepth_V1 Use_WaterLevel_V1

Requires the control parameters:

NmbTrapezes BottomSlope StricklerCoefficients

Requires the derived parameter:

BottomDepths

Requires the factor sequences:

WaterDepth WettedAreas WettedPerimeters

Calculates the flux sequence:

Discharges

Basic equation:
\[\begin{split}Discharges_i = \begin{cases} 0 &|\ d < 0 \\ C \cdot A^{5/3} \cdot P^{-2/3} \cdot \sqrt{S_B} &|\ 0 \leq d \end{cases} \\ \\ d = WaterDepth - BottomDepth_i \\ C = StricklerCoefficient_i \\ A = WettedAreas_i \\ P = WettedPerimeters_i \\ S_B = BottomSlope\end{split}\]

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(4)
>>> bottomslope(0.01)
>>> stricklercoefficients(20.0, 40.0, 60.0, 80.0)
>>> derived.bottomdepths = 1.0, 2.0, 3.0, 4.0
>>> factors.wettedareas = 1.0, 4.0, 8.0, 16.0
>>> factors.wettedperimeters = 2.0, 4.0, 6.0, 8.0
>>> factors.waterdepth = 4.0
>>> model.calc_discharges_v1()
>>> fluxes.discharges
discharges(1.259921, 16.0, 58.147859, 0.0)
class hydpy.models.wq.wq_model.Calc_Discharges_V2[source]

Bases: Method

Calculate the discharge for each cross-section sector.

Required by the methods:

Use_WaterDepth_V3 Use_WaterLevel_V3

Requires the control parameters:

NmbSectors BottomSlope StricklerCoefficients

Requires the factor sequences:

FlowAreas FlowPerimeters

Calculates the flux sequence:

Discharges

Basic equation:
\[\begin{split}Q = \begin{cases} 0 &|\ A < 0 \\ C \cdot A^{5/3} \cdot P^{-2/3} \cdot \sqrt{S} &|\ 0 \leq A \end{cases} \\ \\ Q = Discharges \\ C = StricklerCoefficient \\ A = FlowAreas \\ P = FlowPerimeters \\ S = BottomSlope\end{split}\]

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbsectors(4)
>>> bottomslope(0.01)
>>> stricklercoefficients(20.0, 40.0, 60.0, 80.0)
>>> factors.flowareas = 1.0, 4.0, 8.0, 0.0
>>> factors.flowperimeters = 2.0, 4.0, 6.0, 8.0
>>> model.calc_discharges_v2()
>>> fluxes.discharges
discharges(1.259921, 16.0, 58.147859, 0.0)
class hydpy.models.wq.wq_model.Calc_Discharge_V2[source]

Bases: Method

Sum the individual trapeze ranges’ discharges.

Required by the methods:

Use_WaterDepth_V1 Use_WaterLevel_V1

Requires the control parameter:

NmbTrapezes

Requires the flux sequence:

Discharges

Calculates the flux sequence:

Discharge

Basic equation:

\(Discharge = \sum_{i=1}^{NmbTrapezes} Discharges_i\)

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(3)
>>> fluxes.discharges(2.0, 3.0, 1.0)
>>> model.calc_discharge_v2()
>>> fluxes.discharge
discharge(6.0)
class hydpy.models.wq.wq_model.Calc_Discharge_V3[source]

Bases: Method

Sum up the individual cross-section sectors’ discharges.

Required by the methods:

Use_WaterDepth_V3 Use_WaterLevel_V3

Requires the control parameter:

NmbSectors

Requires the flux sequence:

Discharges

Calculates the flux sequence:

Discharge

Basic equation:

\(Discharge = \sum_{i=1}^{NmbSector} Discharges_i\)

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbsectors(3)
>>> fluxes.discharges(2.0, 3.0, 1.0)
>>> model.calc_discharge_v3()
>>> fluxes.discharge
discharge(6.0)
class hydpy.models.wq.wq_model.Calc_DischargeDerivatives_V1[source]

Bases: Method

Calculate the discharge change for each trapeze range with respect to a water level increase.

Required by the methods:

Use_WaterDepth_V1 Use_WaterLevel_V1

Requires the control parameters:

NmbTrapezes BottomSlope StricklerCoefficients

Requires the derived parameter:

BottomDepths

Requires the factor sequences:

WaterDepth WettedAreas WettedPerimeters WettedPerimeterDerivatives SurfaceWidths

Calculates the factor sequence:

DischargeDerivatives

Basic equation:
\[\begin{split}DischargeDerivatives_i = \begin{cases} 0 &|\ d < 0 \\ C \cdot (A / P)^{5/3} \cdot \frac{5 \cdot P \cdot A' - 2 \cdot A \cdot P'}{3 \cdot P} \cdot \sqrt{S_B} &|\ 0 \leq d \end{cases} \\ \\ d = WaterDepth - BottomDepth_i \\ C = StricklerCoefficient_i \\ A = WettedAreas_i \\ A' = SurfaceWidth_i \\ P = WettedPerimeters_i \\ P' = WettedPerimeterDerivatives_i \\ S_B = BottomSlope\end{split}\]

Example:

The given basic equation assumes that the wetted area, the wetted perimeter, and their derivatives are calculated via methods Calc_WettedAreas_V1, Calc_SurfaceWidths_V1, Calc_WettedPerimeters_V1, and Calc_WettedPerimeterDerivatives_V1. Hence, we apply these methods and check that, after also executing Calc_DischargeDerivatives_V1, the results are sufficiently similar to the numerical approximations gained when applying NumericalDifferentiator to the mentioned methods and method Calc_Discharges_V1:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(4)
>>> bottomlevels(1.0, 3.0, 4.0, 5.0)
>>> bottomwidths(2.0, 0.0, 2.0, 2.0)
>>> sideslopes(0.0, 2.0, 2.0, 2.0)
>>> bottomslope(0.01)
>>> stricklercoefficients(20.0, 40.0, 60.0, 60.0)
>>> factors.waterdepth = 3.5
>>> derived.bottomdepths.update()
>>> derived.trapezeheights.update()
>>> derived.slopewidths.update()
>>> derived.perimeterderivatives.update()
>>> model.calc_wettedareas_v1()
>>> model.calc_surfacewidths_v1()
>>> model.calc_wettedperimeters_v1()
>>> model.calc_wettedperimeterderivatives_v1()
>>> model.calc_dischargederivatives_v1()
>>> factors.dischargederivatives
dischargederivatives(3.884141, 18.475494, 16.850223, 0.0)
>>> from hydpy import NumericalDifferentiator, pub
>>> numdiff = NumericalDifferentiator(
...     xsequence=factors.waterdepth,
...     ysequences=[fluxes.discharges],
...     methods=[model.calc_wettedareas_v1,
...              model.calc_surfacewidths_v1,
...              model.calc_wettedperimeters_v1,
...              model.calc_wettedperimeterderivatives_v1,
...              model.calc_discharges_v1],
...     dx=1e-8)
>>> with pub.options.reprdigits(5):
...     numdiff()
d_discharges/d_waterdepth: 3.88414, 18.47549, 16.85022, 0.0
class hydpy.models.wq.wq_model.Calc_DischargeDerivatives_V2[source]

Bases: Method

Calculate the discharge change for each cross section-sector with respect to a water level increase.

Required by the methods:

Use_WaterDepth_V3 Use_WaterLevel_V3

Requires the control parameters:

NmbSectors Transitions Heights BottomSlope StricklerCoefficients

Requires the factor sequences:

WaterLevel FlowAreas FlowWidths FlowPerimeters FlowPerimeterDerivatives

Calculates the factor sequence:

DischargeDerivatives

Basic equation:
\[\begin{split}Q' = \begin{cases} 0 &|\ L \leq H \\ C \cdot (A / P)^{5/3} \cdot \frac{5 \cdot P \cdot A' - 2 \cdot A \cdot P'}{3 \cdot P} \cdot \sqrt{S} &|\ L > H \end{cases} \\ \\ Q' = DischargeDerivatives \\ L = WaterLevel \\ H = Heights \\ C = StricklerCoefficient \\ A = FlowAreas \\ A' = FlowWidth \\ P = FlowPerimeters \\ P' = FlowPerimeterDerivatives \\ S = BottomSlope\end{split}\]

Example:

The following example reuses the same cross-section configuration as the example on method Calc_DischargeDerivatives_V1 and so results in the same derivative estimates:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbwidths(7)
>>> nmbsectors(4)
>>> heights(1.0, 3.0, 4.0, 4.0, 5.0, 5.0, 6.0)
>>> flowwidths(2.0, 2.0, 6.0, 8.0, 12.0, 14.0, 16.0)
>>> transitions(1, 2, 4)
>>> bottomslope(0.01)
>>> stricklercoefficients(20.0, 40.0, 60.0, 60.0)
>>> derived.sectorflowwidths.update()
>>> derived.sectorflowareas.update()
>>> derived.sectorflowperimeterderivatives.update()
>>> derived.sectorflowperimeters.update()
>>> factors.waterlevel = 4.5
>>> model.calc_index_excess_weight_v1()
>>> model.calc_flowwidths_v1()
>>> model.calc_flowareas_v1()
>>> model.calc_flowperimeters_v1()
>>> model.calc_flowperimeterderivatives_v1()
>>> model.calc_dischargederivatives_v2()
>>> factors.dischargederivatives
dischargederivatives(3.884141, 18.475494, 16.850223, 0.0)
class hydpy.models.wq.wq_model.Calc_DischargeDerivative_V1[source]

Bases: Method

Sum the individual trapeze ranges’ discharge derivatives.

Required by the methods:

Use_WaterDepth_V1 Use_WaterLevel_V1

Requires the control parameter:

NmbTrapezes

Requires the factor sequence:

DischargeDerivatives

Calculates the factor sequence:

DischargeDerivative

Basic equation:

\(DischargeDerivative = \sum_{i=1}^{NmbTrapezes} DischargeDerivatives_i\)

Examples:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(3)
>>> bottomslope(0.01)
>>> factors.dischargederivatives(2.0, 3.0, 1.0)
>>> model.calc_dischargederivative_v1()
>>> factors.dischargederivative
dischargederivative(6.0)
class hydpy.models.wq.wq_model.Calc_DischargeDerivative_V2[source]

Bases: Method

Sum the individual cross-section sectors’ discharge derivatives.

Required by the methods:

Use_WaterDepth_V3 Use_WaterLevel_V3

Requires the control parameter:

NmbSectors

Requires the factor sequence:

DischargeDerivatives

Calculates the factor sequence:

DischargeDerivative

Basic equation:

\(DischargeDerivative = \sum_{i=1}^{NmbSectors} DischargeDerivatives_i\)

Examples:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbsectors(3)
>>> bottomslope(0.01)
>>> factors.dischargederivatives(2.0, 3.0, 1.0)
>>> model.calc_dischargederivative_v2()
>>> factors.dischargederivative
dischargederivative(6.0)
class hydpy.models.wq.wq_model.Calc_Celerity_V1[source]

Bases: Method

Calculate the kinematic wave celerity.

Required by the methods:

Use_WaterDepth_V1 Use_WaterLevel_V1

Requires the factor sequences:

DischargeDerivative SurfaceWidth

Calculates the factor sequence:

Celerity

Basic equation:

\(Celerity = \frac{DischargeDerivative}{SurfaceWidth}\)

Examples:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> factors.dischargederivative = 6.0
>>> factors.surfacewidth = 2.0
>>> model.calc_celerity_v1()
>>> factors.celerity
celerity(3.0)
>>> factors.surfacewidth = 0.0
>>> model.calc_celerity_v1()
>>> factors.celerity
celerity(nan)
class hydpy.models.wq.wq_model.Calc_Celerity_V2[source]

Bases: Method

Calculate the kinematic wave celerity.

Required by the methods:

Use_WaterDepth_V3 Use_WaterLevel_V3

Requires the factor sequences:

DischargeDerivative TotalWidth

Calculates the factor sequence:

Celerity

Basic equation:

\(Celerity = \frac{DischargeDerivative}{TotalWidth}\)

Examples:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> factors.dischargederivative = 6.0
>>> factors.totalwidth = 2.0
>>> model.calc_celerity_v2()
>>> factors.celerity
celerity(3.0)
>>> factors.totalwidth = 0.0
>>> model.calc_celerity_v2()
>>> factors.celerity
celerity(nan)
class hydpy.models.wq.wq_model.Set_WaterDepth_V1[source]

Bases: Method

Set the water depth in m.

Required by the methods:

Use_WaterDepth_V1 Use_WaterDepth_V2 Use_WaterDepth_V3

Calculates the factor sequence:

WaterDepth

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> model.set_waterdepth_v1(2.0)
>>> factors.waterdepth
waterdepth(2.0)
class hydpy.models.wq.wq_model.Set_WaterLevel_V1[source]

Bases: Method

Set the water level in m.

Required by the methods:

Use_WaterLevel_V1 Use_WaterLevel_V2 Use_WaterLevel_V3

Calculates the factor sequence:

WaterLevel

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> model.set_waterlevel_v1(2.0)
>>> factors.waterlevel
waterlevel(2.0)
class hydpy.models.wq.wq_model.Set_WettedArea_V1[source]

Bases: Method

Set the wetted area in m².

Required by the method:

Use_WettedArea_V1

Calculates the factor sequence:

WettedArea

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> model.set_wettedarea_v1(2.0)
>>> factors.wettedarea
wettedarea(2.0)
class hydpy.models.wq.wq_model.Use_WaterDepth_V1[source]

Bases: SetAutoMethod

Set the water depth in m and use it to calculate all other properties.

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(2)
>>> bottomlevels(1.0, 3.0)
>>> bottomwidths(2.0, 2.0)
>>> sideslopes(0.0, 0.0)
>>> bottomslope(0.01)
>>> stricklercoefficients(20.0, 40.0)
>>> derived.bottomdepths.update()
>>> derived.trapezeheights.update()
>>> derived.slopewidths.update()
>>> derived.perimeterderivatives.update()
>>> model.use_waterdepth_v1(3.0)
>>> factors.waterdepth
waterdepth(3.0)
>>> factors.waterlevel
waterlevel(4.0)
>>> factors.wettedarea
wettedarea(8.0)
>>> fluxes.discharge
discharge(14.945466)
>>> factors.celerity
celerity(2.642957)
class hydpy.models.wq.wq_model.Use_WaterDepth_V2[source]

Bases: SetAutoMethod

Set the water depth in m and use it to calculate all other properties.

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(2)
>>> bottomlevels(1.0, 3.0)
>>> bottomwidths(2.0, 2.0)
>>> sideslopes(0.0, 0.0)
>>> derived.bottomdepths.update()
>>> derived.trapezeheights.update()
>>> derived.slopewidths.update()
>>> model.use_waterdepth_v2(3.0)
>>> factors.waterdepth
waterdepth(3.0)
>>> factors.waterlevel
waterlevel(4.0)
>>> factors.wettedarea
wettedarea(8.0)
>>> factors.wettedperimeter
wettedperimeter(12.0)
class hydpy.models.wq.wq_model.Use_WaterDepth_V3[source]

Bases: SetAutoMethod

Set the water depth in m and use it to calculate all other properties.

Required submethods:

Set_WaterDepth_V1 Calc_WaterLevel_V2 Calc_Index_Excess_Weight_V1 Calc_FlowWidths_V1 Calc_TotalWidths_V1 Calc_TotalWidth_V1 Calc_FlowAreas_V1 Calc_TotalAreas_V1 Calc_FlowPerimeters_V1 Calc_FlowPerimeterDerivatives_V1 Calc_FlowArea_V1 Calc_TotalArea_V1 Calc_Discharges_V2 Calc_Discharge_V3 Calc_DischargeDerivatives_V2 Calc_DischargeDerivative_V2 Calc_Celerity_V2

Requires the control parameters:

NmbSectors NmbWidths Transitions Heights StricklerCoefficients BottomSlope

Requires the derived parameters:

SectorFlowWidths SectorTotalWidths SectorFlowAreas SectorTotalAreas SectorFlowPerimeters SectorFlowPerimeterDerivatives

Calculates the factor sequences:

WaterDepth WaterLevel FlowAreas FlowArea TotalAreas TotalArea FlowPerimeters FlowPerimeterDerivatives FlowWidths TotalWidths TotalWidth DischargeDerivatives DischargeDerivative Celerity

Calculates the flux sequences:

Discharges Discharge

Calculates the aide sequences:

Index Excess Weight

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbsectors(2)
>>> nmbwidths(3)
>>> heights(1.0, 3.0, 3.0)
>>> flowwidths(2.0, 2.0, 4.0)
>>> totalwidths(2.0, 2.0, 4.0)
>>> transitions(1)
>>> stricklercoefficients(20.0, 40.0)
>>> bottomslope(0.01)
>>> derived.sectorflowwidths.update()
>>> derived.sectortotalwidths.update()
>>> derived.sectorflowareas.update()
>>> derived.sectortotalareas.update()
>>> derived.sectorflowperimeters.update()
>>> derived.sectorflowperimeterderivatives.update()
>>> model.use_waterdepth_v3(3.0)
>>> factors.waterdepth
waterdepth(3.0)
>>> factors.waterlevel
waterlevel(4.0)
>>> factors.flowarea
flowarea(8.0)
>>> factors.totalarea
totalarea(8.0)
>>> fluxes.discharge
discharge(14.945466)
>>> factors.celerity
celerity(2.642957)
class hydpy.models.wq.wq_model.Use_WaterLevel_V1[source]

Bases: SetAutoMethod

Set the water level in m and use it to calculate all other properties.

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(2)
>>> bottomlevels(1.0, 3.0)
>>> bottomwidths(2.0, 2.0)
>>> sideslopes(0.0, 0.0)
>>> bottomslope(0.01)
>>> stricklercoefficients(20.0, 40.0)
>>> derived.bottomdepths.update()
>>> derived.trapezeheights.update()
>>> derived.slopewidths.update()
>>> derived.perimeterderivatives.update()
>>> model.use_waterlevel_v1(4.0)
>>> factors.waterdepth
waterdepth(3.0)
>>> factors.waterlevel
waterlevel(4.0)
>>> factors.wettedarea
wettedarea(8.0)
>>> fluxes.discharge
discharge(14.945466)
>>> factors.celerity
celerity(2.642957)
class hydpy.models.wq.wq_model.Use_WaterLevel_V2[source]

Bases: SetAutoMethod

Set the water level in m and use it to calculate all other properties.

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(2)
>>> bottomlevels(1.0, 3.0)
>>> bottomwidths(2.0, 2.0)
>>> sideslopes(0.0, 0.0)
>>> derived.bottomdepths.update()
>>> derived.trapezeheights.update()
>>> derived.slopewidths.update()
>>> model.use_waterlevel_v2(4.0)
>>> factors.waterdepth
waterdepth(3.0)
>>> factors.waterlevel
waterlevel(4.0)
>>> factors.wettedarea
wettedarea(8.0)
>>> factors.wettedperimeter
wettedperimeter(12.0)
class hydpy.models.wq.wq_model.Use_WaterLevel_V3[source]

Bases: SetAutoMethod

Set the water level in m and use it to calculate all other properties.

Required submethods:

Set_WaterLevel_V1 Calc_WaterDepth_V3 Calc_Index_Excess_Weight_V1 Calc_FlowWidths_V1 Calc_TotalWidths_V1 Calc_TotalWidth_V1 Calc_FlowAreas_V1 Calc_TotalAreas_V1 Calc_FlowPerimeters_V1 Calc_FlowPerimeterDerivatives_V1 Calc_FlowArea_V1 Calc_TotalArea_V1 Calc_Discharges_V2 Calc_Discharge_V3 Calc_DischargeDerivatives_V2 Calc_DischargeDerivative_V2 Calc_Celerity_V2

Requires the control parameters:

NmbSectors NmbWidths Transitions Heights StricklerCoefficients BottomSlope

Requires the derived parameters:

SectorFlowWidths SectorTotalWidths SectorFlowAreas SectorTotalAreas SectorFlowPerimeters SectorFlowPerimeterDerivatives

Calculates the factor sequences:

WaterDepth WaterLevel FlowAreas FlowArea TotalAreas TotalArea FlowPerimeters FlowPerimeterDerivatives FlowWidths TotalWidths TotalWidth DischargeDerivatives DischargeDerivative Celerity

Calculates the flux sequences:

Discharges Discharge

Calculates the aide sequences:

Index Excess Weight

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbsectors(2)
>>> nmbwidths(3)
>>> heights(1.0, 3.0, 3.0)
>>> flowwidths(2.0, 2.0, 4.0)
>>> totalwidths(2.0, 2.0, 4.0)
>>> transitions(1)
>>> stricklercoefficients(20.0, 40.0)
>>> bottomslope(0.01)
>>> derived.sectorflowwidths.update()
>>> derived.sectortotalwidths.update()
>>> derived.sectorflowareas.update()
>>> derived.sectortotalareas.update()
>>> derived.sectorflowperimeters.update()
>>> derived.sectorflowperimeterderivatives.update()
>>> model.use_waterlevel_v3(4.0)
>>> factors.waterdepth
waterdepth(3.0)
>>> factors.waterlevel
waterlevel(4.0)
>>> factors.flowarea
flowarea(8.0)
>>> factors.totalarea
totalarea(8.0)
>>> fluxes.discharge
discharge(14.945466)
>>> factors.celerity
celerity(2.642957)
class hydpy.models.wq.wq_model.Use_WettedArea_V1[source]

Bases: SetAutoMethod

Set the wetted area in m² and use it to calculate all other properties.

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(2)
>>> bottomlevels(1.0, 3.0)
>>> bottomwidths(2.0, 2.0)
>>> sideslopes(0.0, 0.0)
>>> derived.bottomdepths.update()
>>> derived.trapezeheights.update()
>>> derived.slopewidths.update()
>>> derived.trapezeareas.update()
>>> model.use_wettedarea_v1(8.0)
>>> factors.waterdepth
waterdepth(3.0)
>>> factors.waterlevel
waterlevel(4.0)
>>> factors.wettedarea
wettedarea(8.0)
>>> factors.wettedperimeter
wettedperimeter(12.0)
class hydpy.models.wq.wq_model.Get_WaterDepth_V1[source]

Bases: Method

Get the water depth in m.

Requires the factor sequence:

WaterDepth

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> factors.waterdepth = 2.0
>>> model.get_waterdepth_v1()
2.0
class hydpy.models.wq.wq_model.Get_WaterLevel_V1[source]

Bases: Method

Get the water level in m.

Requires the factor sequence:

WaterLevel

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> factors.waterlevel = 2.0
>>> model.get_waterlevel_v1()
2.0
class hydpy.models.wq.wq_model.Get_WettedArea_V1[source]

Bases: Method

Get the wetted area in m².

Requires the factor sequence:

WettedArea

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> factors.wettedarea = 2.0
>>> model.get_wettedarea_v1()
2.0
class hydpy.models.wq.wq_model.Get_WettedArea_V2[source]

Bases: Method

Get the wetted area in m².

Requires the factor sequence:

TotalArea

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> factors.totalarea = 2.0
>>> model.get_wettedarea_v2()
2.0
class hydpy.models.wq.wq_model.Get_WettedPerimeter_V1[source]

Bases: Method

Get the wetted perimeter in m.

Requires the factor sequence:

WettedPerimeter

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> factors.wettedperimeter = 2.0
>>> model.get_wettedperimeter_v1()
2.0
class hydpy.models.wq.wq_model.Get_SurfaceWidth_V1[source]

Bases: Method

Get the surface width in m.

Requires the factor sequence:

SurfaceWidth

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> factors.surfacewidth = 2.0
>>> model.get_surfacewidth_v1()
2.0
class hydpy.models.wq.wq_model.Get_SurfaceWidth_V2[source]

Bases: Method

Get the surface width in m.

Requires the factor sequence:

TotalWidth

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> factors.totalwidth = 2.0
>>> model.get_surfacewidth_v2()
2.0
class hydpy.models.wq.wq_model.Get_Discharge_V1[source]

Bases: Method

Get the discharge in m³/s.

Requires the flux sequence:

Discharge

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> fluxes.discharge = 2.0
>>> model.get_discharge_v1()
2.0
class hydpy.models.wq.wq_model.Get_Celerity_V1[source]

Bases: Method

Get the wave celerity in m/s.

Requires the factor sequence:

Celerity

Example:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> factors.celerity = 2.0
>>> model.get_celerity_v1()
2.0
class hydpy.models.wq.wq_model.TrapezeModel[source]

Bases: AdHocModel

Base class for HydPy-WQ models that rely on trapezoidal geometries.

plot(*, ymax: float | None = None, color: str | None = None, label: bool | str = False) Figure[source]

Plot the channel profile.

See the main documentation of the application model wq_trapeze for more information.

get_depths_of_discontinuity() tuple[float, ...][source]

Get the depths of all trapeze bottoms (except zero).

>>> from hydpy.models.wq_trapeze_strickler import *
>>> parameterstep()
>>> nmbtrapezes(1)
>>> bottomlevels(1.0)
>>> model.get_depths_of_discontinuity()
()
>>> nmbtrapezes(3)
>>> bottomlevels(1.0, 3.0, 4.0)
>>> from hydpy import print_vector
>>> print_vector(model.get_depths_of_discontinuity())
2.0, 3.0
REUSABLE_METHODS: ClassVar[tuple[type[ReusableMethod], ...]] = ()
class hydpy.models.wq.wq_model.WidthsModel[source]

Bases: AdHocModel

Base class for HydPy-WQ models that rely on width measurements.

plot(*, ymax: float | None = None, color: str | None = None, label: bool | str = False) Figure[source]

Plot the channel profile.

The following tests closely resemble those of wq_trapeze for comparison and serve the same purpose: to clarify how individual parameter values translate into actual geometries. Like for the wq_trapeze examples, we first create a test function that simplifies inserting generated figures into the online documentation:

>>> from hydpy.core.testtools import save_autofig
>>> def plot(example, label=False):
...     figure = model.plot(label=label)
...     save_autofig(f"wq_widths_{example}.png", figure=figure)

Basically, “width models” as wq_widths_strickler rely on cross-section widths measured (or otherwise estimated) at different heights. In the case of a simple rectangular profile, defining a single measurement suffices:

>>> from hydpy.models.wq_widths_strickler import *
>>> parameterstep()
>>> nmbwidths(1)

Principally, one can define multiple subsectors within a cross-section, for example, to perform separate discharge estimations with different friction coefficients. Each transition from one sector to its neighbour must lie at a height/width pair. However, when defining only a single height/width pair, as in this example, we can only specify a single sector:

>>> nmbsectors(1)

wq_widths_strickler uses the neutral term “height” because submodels should be able to handle water levels as well as water depths. Here, we set the single height to 1 m:

>>> heights(1.0)

In contrast to “trapeze models”, “width models” allow for differentiation between active and passive areas within a cross-section profile. We set the rectangle’s “flow width”, which is actively involved in water routing, to 2 m:

>>> flowwidths(2.0)

We set the “total widths” to 3 m, so that a rest of 1 m, which contributes to storing but not to routing water, remains (this can be useful to approximately consider, for example, the effects of groynes):

>>> totalwidths(3.0)

The plot routine adds the cross-section’s active part in dashed lines:

>>> plot("rectangle")
_images/wq_widths_rectangle.png

Defining a triangular cross-section requires (at least) two height/width pairs. Above the highest height/value pair, the profile’s outlines are, somewhat in contrast to wq_trapeze, vertically oriented:

>>> nmbwidths(2)
>>> heights(1.0, 2.0)
>>> flowwidths(0.0, 4.0)
>>> totalwidths(0.0, 6.0)
>>> plot("triangle")
_images/wq_widths_triangle.png

For a simple trapeze, two height/width pairs are also sufficient:

>>> flowwidths(2.0, 6.0)
>>> totalwidths(2.0, 8.0)
>>> plot("one_trapeze")
_images/wq_widths_one_trapeze.png

Next, we define a three-trapeze profile identical to one in the documentation of wq_trapeze (except for the vertically oriented outlines above the highest height/width pair). Therefore, we need to define five height/width pairs:

>>> nmbwidths(5)

It is allowed to define multiple widths for the same height. Here, we make use of this to model the upper trapeze’s bottom:

>>> heights(1.0, 3.0, 4.0, 4.0, 5.0)
>>> flowwidths(2.0, 2.0, 6.0, 8.0, 12.0)
>>> totalwidths(2.0, 2.0, 6.0, 10.0, 14.0)

Increasing the value of parameter NmbSectors to three and setting the suitable transition indices via the index parameter Transitions results in a definition of separate sectors analogous to the definition of separate trapeze ranges in the wq_trapeze example:

>>> nmbsectors(3)
>>> transitions(1, 2)

All transitions are marked via circles:

>>> from hydpy import Element
>>> e = Element("three_trapezes_1")
>>> e.model = model
>>> plot("three_trapezes_1", label=True)
_images/wq_widths_three_trapezes_1.png

In the last example, most of the outline and all transition points of the total cross-section overlay the corresponding properties of the subarea that contributes actively to water routing. The following example shows that those properties are depicted by solid lines and filled circles and by dashed lines and empty circles, respectively:

>>> transitions(1, 3)
>>> plot("three_trapezes_2", label="three_trapezes_2")
_images/wq_widths_three_trapezes_2.png
get_depths_of_discontinuity() tuple[float, ...][source]

Get all measurement heights (except the first one).

>>> from hydpy.models.wq_widths_strickler import *
>>> parameterstep()
>>> nmbwidths(1)
>>> heights(1.0)
>>> model.get_depths_of_discontinuity()
()
>>> nmbwidths(3)
>>> heights(1.0, 3.0, 4.0)
>>> from hydpy import print_vector
>>> print_vector(model.get_depths_of_discontinuity())
2.0, 3.0
REUSABLE_METHODS: ClassVar[tuple[type[ReusableMethod], ...]] = ()
class hydpy.models.wq.wq_model.Base_DischargeModel_V2[source]

Bases: DischargeModel_V2

Base class for HydPy-WQ models that comply with the DischargeModel_V2 submodel interface.

prepare_channeldepth

Set the channel depth in m.

>>> from hydpy.models.wq_walrus import *
>>> parameterstep()
>>> model.prepare_channeldepth(2.0)
>>> channeldepth
channeldepth(2.0)
prepare_tolerance

Set the depth-related smoothing parameter in m.

>>> from hydpy.models.wq_walrus import *
>>> parameterstep()
>>> model.prepare_tolerance(2.0)
>>> crestheighttolerance
crestheighttolerance(2.0)
REUSABLE_METHODS: ClassVar[tuple[type[ReusableMethod], ...]] = ()
preparemethod2arguments: dict[str, tuple[tuple[Any, ...], dict[str, Any]]]
cymodel: CyModelProtocol | None
parameters: parametertools.Parameters
sequences: sequencetools.Sequences
masks: masktools.Masks
OBSERVER_METHODS: ClassVar[tuple[type[Method], ...]]
METHOD_GROUPS: ClassVar[tuple[str, ...]]
DOCNAME: DocName

Variable Features

Variable tools

class hydpy.models.wq.wq_variables.MixinTrapezes(subvars: SubVariables)[source]

Bases: Variable, ABC

Mixin class for 1-dimensional parameters and sequences whose shape depends on the value of the parameter NmbTrapezes.

NDIM: int = 1
name: str = 'mixintrapezes'

Name of the variable in lowercase letters.

unit: str = '?'

Unit of the variable.

TYPE: type[float | int | bool]
class hydpy.models.wq.wq_variables.MixinWidths(subvars: SubVariables)[source]

Bases: Variable, ABC

Mixin class for 1-dimensional parameters and sequences whose shape depends on the value of the parameter NmbWidths.

NDIM: int = 1
name: str = 'mixinwidths'

Name of the variable in lowercase letters.

unit: str = '?'

Unit of the variable.

TYPE: type[float | int | bool]
class hydpy.models.wq.wq_variables.MixinSectorsAndWidths(subvars: SubVariables)[source]

Bases: Variable, ABC

Mixin class for 2-dimensional parameters and sequences whose shape depends on the values of the parameters NmbSectors and NmbWidths.

NDIM: int = 2
name: str = 'mixinsectorsandwidths'

Name of the variable in lowercase letters.

unit: str = '?'

Unit of the variable.

TYPE: type[float | int | bool]
class hydpy.models.wq.wq_variables.MixinTrapezesOrSectors(subvars: SubVariables)[source]

Bases: Variable, ABC

Mixin class for 1-dimensional parameters and sequences whose shape depends on the value of parameter NmbTrapezes or parameter NmbSectors.

NDIM: int = 1
name: str = 'mixintrapezesorsectors'

Name of the variable in lowercase letters.

unit: str = '?'

Unit of the variable.

TYPE: type[float | int | bool]

Parameter Features

Control parameters

class hydpy.models.wq.ControlParameters(master: Parameters, cls_fastaccess: type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)

Bases: SubParameters

Control parameters of model wq.

The following classes are selected:
class hydpy.models.wq.wq_control.NmbTrapezes(subvars: SubParameters)[source]

Bases: NmbParameter

Number of trapezes defining the cross section [-].

Required by the methods:

Calc_DischargeDerivative_V1 Calc_DischargeDerivatives_V1 Calc_Discharge_V2 Calc_Discharges_V1 Calc_SurfaceWidth_V1 Calc_SurfaceWidths_V1 Calc_WaterDepth_V2 Calc_WettedArea_V1 Calc_WettedAreas_V1 Calc_WettedPerimeterDerivatives_V1 Calc_WettedPerimeter_V1 Calc_WettedPerimeters_V1 Use_WaterDepth_V1 Use_WaterDepth_V2 Use_WaterLevel_V1 Use_WaterLevel_V2 Use_WettedArea_V1

SPAN: tuple[int | float | bool | None, int | float | bool | None] = (1, None)
name: str = 'nmbtrapezes'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.wq.wq_control.NmbWidths(subvars: SubParameters)[source]

Bases: NmbParameter

Number of widths that define the cross section [-].

Required by the methods:

Calc_Index_Excess_Weight_V1 Use_WaterDepth_V3 Use_WaterLevel_V3

SPAN: tuple[int | float | bool | None, int | float | bool | None] = (1, None)
trim(lower=None, upper=None) bool[source]

Check according to \(NmbWidths \geq NmbSectors\).

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbwidths(5)
>>> nmbwidths
nmbwidths(5)
>>> nmbsectors(3)
>>> nmbwidths(3)
>>> nmbwidths
nmbwidths(3)
>>> nmbwidths(2)
Traceback (most recent call last):
...
ValueError: The value `2` of parameter `nmbwidths` of element `?` is not valid.
name: str = 'nmbwidths'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.wq.wq_control.NmbSectors(subvars: SubParameters)[source]

Bases: NmbParameter

Number of the separately calculated sectors of the cross section [-].

Required by the methods:

Calc_DischargeDerivative_V2 Calc_DischargeDerivatives_V2 Calc_Discharge_V3 Calc_Discharges_V2 Calc_FlowArea_V1 Calc_FlowAreas_V1 Calc_FlowPerimeterDerivatives_V1 Calc_FlowPerimeters_V1 Calc_FlowWidths_V1 Calc_TotalArea_V1 Calc_TotalAreas_V1 Calc_TotalWidth_V1 Calc_TotalWidths_V1 Use_WaterDepth_V3 Use_WaterLevel_V3

SPAN: tuple[int | float | bool | None, int | float | bool | None] = (1, None)
trim(lower=None, upper=None) bool[source]

Check according to \(NmbSectors \leq NmbWidths\).

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbsectors(2)
>>> nmbsectors
nmbsectors(2)
>>> nmbwidths(4)
>>> nmbsectors(4)
>>> nmbsectors
nmbsectors(4)
>>> nmbsectors(5)
Traceback (most recent call last):
...
ValueError: The value `5` of parameter `nmbsectors` of element `?` is not valid.
name: str = 'nmbsectors'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.wq.wq_control.Heights(subvars: SubParameters)[source]

Bases: MixinWidths, SortedParameter

The measurement heights of the widths defining the cross section [m].

If water levels are essential, we encourage using the sea level as a reference. If not (as for common hydrological routing approaches), one could also set the lowest tabulated level to zero.

TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (None, None)
name: str = 'heights'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_control.FlowWidths(subvars: SubParameters)[source]

Bases: MixinWidths, SortedParameter

The widths of those subareas of the cross section involved in water routing [m].

TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
trim(lower=None, upper=None) bool[source]

Trim according to \(FlowWidths \leq TotalWidths\).

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbwidths(3)
>>> flowwidths(1.0, 2.0, 3.0)
>>> flowwidths
flowwidths(1.0, 2.0, 3.0)
>>> totalwidths(3.0, 4.0, 5.0)
>>> flowwidths(2.0, 4.0, 6.0)
>>> flowwidths
flowwidths(2.0, 4.0, 5.0)
name: str = 'flowwidths'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_control.TotalWidths(subvars: SubParameters)[source]

Bases: MixinWidths, SortedParameter

The widths of the total cross section [m].

TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
trim(lower=None, upper=None) bool[source]

Trim according to \(TotalWidths \geq FlowWidths\).

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbwidths(3)
>>> totalwidths(4.0, 5.0, 6.0)
>>> totalwidths
totalwidths(4.0, 5.0, 6.0)
>>> flowwidths(3.0, 4.0, 5.0)
>>> totalwidths(2.0, 4.0, 6.0)
>>> totalwidths
totalwidths(3.0, 4.0, 6.0)
name: str = 'totalwidths'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_control.Transitions(subvars: SubParameters)[source]

Bases: Parameter

Indexes that mark the transitions between separately calculated cross-section sectors [m].

According to the Python convention, the index \(0\) would mark the first, and the index \(n - 1\) would mark the last height/width pair. However, precisely these two values are disallowed for reasons we explain in the following.

Parameter Transitions defines the transitions between all neighbouring sectors. Hence, one does not need to specify any value if there is only one sector:

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbsectors(1)
>>> transitions
transitions()

In such cases, it is okay to pass nothing when using the usual parameter value setting syntax:

>>> transitions()
>>> transitions
transitions()

The number of the required values depends on NmbSectors, while the range of the allowed values depends on NmbWidths:

>>> nmbwidths(7)
>>> nmbsectors(4)
>>> transitions(1, 4, 5)
>>> transitions
transitions(1, 4, 5)

The index value \(0\) is not allowed because there is no sector below the “lowest” height/width pair:

>>> transitions(0, 4, 6)
Traceback (most recent call last):
...
ValueError: The smallest possible index value of parameter `transitions` of element `?` is 1, but 0 is given.
>>> transitions
transitions(-999999)

The same logic holds for the “highest” height/width pair:

>>> transitions(1, 4, 6)
Traceback (most recent call last):
...
ValueError: The largest possible index value of parameter `transitions` of element `?` is 5 (NmbWidths - 2), but 6 is given.
>>> transitions
transitions(-999999)

Besides this, one must ensure that the index values are correctly sorted:

>>> transitions(1, 4, 4)
Traceback (most recent call last):
...
ValueError: The index values given to parameter `transitions` of element `?` are not strictly rising (1, 4, and 4).
>>> transitions
transitions(-999999)
NDIM: int = 1
TYPE

alias of int

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (1, None)
trim(lower=None, upper=None) bool[source]

Regular trimming is disabled in favour of the special checks described in the main documentation of parameter Transitions.

name: str = 'transitions'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_control.BottomLevels(subvars: SubParameters)[source]

Bases: MixinTrapezes, SortedParameter

The bottom level for each trapeze [m].

If water levels are essential, we encourage using the sea level as a reference. If not (as for common hydrological routing approaches), one could also set the lowest trapeze’s bottom level to zero.

TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (None, None)
name: str = 'bottomlevels'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_control.BottomWidths(subvars: SubParameters)[source]

Bases: MixinTrapezes, Parameter

The bottom width for each trapeze [m].

For example, when dealing with the second trapeze, the corresponding value of BottomWidths represents the sum of the trapeze’s partial bottoms on the left and right sides of the first trapeze.

TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'bottomwidths'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_control.SideSlopes(subvars: SubParameters)[source]

Bases: MixinTrapezes, Parameter

The side slope for each trapeze[-].

A value of zero corresponds to a rectangular shape. A value of two corresponds to a half-meter elevation increase for each additional meter distance from the trapeze’s centre.

TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'sideslopes'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.wq.wq_control.StricklerCoefficients(subvars: SubParameters)[source]

Bases: MixinTrapezesOrSectors, Parameter

Manning-Strickler coefficient for each trapeze [m^(1/3)/s].

The higher the coefficient’s value, the higher the calculated discharge. Typical values range from 20 to 80.

TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'stricklercoefficients'

Name of the variable in lowercase letters.

unit: str = 'm^(1/3)/s'

Unit of the variable.

class hydpy.models.wq.wq_control.BottomSlope(subvars: SubParameters)[source]

Bases: Parameter

Bottom slope [-].

\(BottomSlope = \frac{elevation_{start} - elevation_{end}}{length}\)

NDIM: int = 0
TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'bottomslope'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.wq.wq_control.ChannelDepth(subvars: SubParameters)[source]

Bases: Parameter

Channel depth [m].

Required by the method:

Calculate_Discharge_V1

NDIM: int = 0
TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'channeldepth'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_control.CrestHeight(subvars: SubParameters)[source]

Bases: Parameter

The height of the weir’s crest above the channel bottom [m].

Required by the method:

Calculate_Discharge_V1

Set CrestHeight to zero for channels without weirs.

NDIM: int = 0
TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'crestheight'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_control.CrestHeightTolerance(subvars: SubParameters)[source]

Bases: Parameter

Smoothing parameter related to the difference between the water depth and the crest height [m].

NDIM: int = 0
TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'crestheighttolerance'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_control.BankfullDischarge(subvars: SubParameters)[source]

Bases: Parameter

Bankfull discharge [mm/T].

Required by the method:

Calculate_Discharge_V1

NDIM: int = 0
TYPE

alias of float

TIME: bool | None = True
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'bankfulldischarge'

Name of the variable in lowercase letters.

unit: str = 'mm/T'

Unit of the variable.

class hydpy.models.wq.wq_control.DischargeExponent(subvars: SubParameters)[source]

Bases: Parameter

Exponent of the water depth-discharge relation [-].

Required by the method:

Calculate_Discharge_V1

NDIM: int = 0
TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
INIT: int | float | bool | None = 1.5
name: str = 'dischargeexponent'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

Derived parameters

class hydpy.models.wq.DerivedParameters(master: Parameters, cls_fastaccess: type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)

Bases: SubParameters

Derived parameters of model wq.

The following classes are selected:
  • BottomDepths() The cumulated depth of a trapeze and its lower neighbours [m].

  • TrapezeHeights() The individual height of each trapeze [m].

  • SlopeWidths() The total width of both side slopes of each trapeze.

  • TrapezeAreas() The individual area of each trapeze [m].

  • PerimeterDerivatives() Change of the perimeter of each trapeze relative to a water level increase within the trapeze’s range [-].

  • SectorFlowWidths() The sector-specific widths of those subareas of the cross section involved in water routing [m].

  • SectorTotalWidths() The sector-specific widths of the total cross section [m].

  • SectorFlowAreas() The sector-specific wetted areas of those subareas of the cross section involved in water routing [m²].

  • SectorTotalAreas() The sector-specific wetted areas of the total cross section [m²].

  • SectorFlowPerimeters() The sector-specific wetted perimeters of those subareas of the cross section involved in water routing [m].

  • SectorFlowPerimeterDerivatives() The sector-specific changes in the wetted perimeters of those subareas of the cross section involved in water routing with respect to water level increases [m].

  • CrestHeightRegularisation() Regularisation parameter related to the difference between the water depth and the crest height [m].

class hydpy.models.wq.wq_derived.BottomDepths(subvars: SubParameters)[source]

Bases: MixinTrapezes, Parameter

The cumulated depth of a trapeze and its lower neighbours [m].

Required by the methods:

Calc_DischargeDerivatives_V1 Calc_Discharges_V1 Calc_SurfaceWidths_V1 Calc_WettedAreas_V1 Calc_WettedPerimeterDerivatives_V1 Calc_WettedPerimeters_V1 Use_WaterDepth_V1 Use_WaterDepth_V2 Use_WaterLevel_V1 Use_WaterLevel_V2 Use_WettedArea_V1

TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
update() None[source]

Calculate the depth values based on \(BottomDepths_i = BottomLevels_i - BottomLevels_0\).

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(3)
>>> bottomlevels(1.0, 4.0, 6.0)
>>> derived.bottomdepths.update()
>>> derived.bottomdepths
bottomdepths(0.0, 3.0, 5.0)
name: str = 'bottomdepths'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_derived.TrapezeHeights(subvars: SubParameters)[source]

Bases: MixinTrapezes, Parameter

The individual height of each trapeze [m].

The highest trapeze has no upper neighbour and is thus infinitely high.

TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
update() None[source]

Calculate the height values based on \(TrapezeHeights_i = BottomLevels_{i+1} - BottomLevels_i\).

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(3)
>>> bottomlevels(1.0, 4.0, 6.0)
>>> derived.trapezeheights.update()
>>> derived.trapezeheights
trapezeheights(3.0, 2.0, inf)
name: str = 'trapezeheights'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_derived.SlopeWidths(subvars: SubParameters)[source]

Bases: MixinTrapezes, Parameter

The total width of both side slopes of each trapeze.

The highest trapeze has no upper neighbour and is thus infinitely high and potentially infinitely wide.

TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
update() None[source]

Calculate the slope width values based on \(SlopeWidths = 2 \cdot SideSlopes \cdot TrapezeHeights\).

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(3)
>>> sideslopes(0.0, 2.0, 2.0)
>>> derived.trapezeheights(2.0, 3.0, inf)
>>> derived.slopewidths.update()
>>> derived.slopewidths
slopewidths(0.0, 12.0, inf)
name: str = 'slopewidths'

Name of the variable in lowercase letters.

unit: str = '?'

Unit of the variable.

class hydpy.models.wq.wq_derived.TrapezeAreas(subvars: SubParameters)[source]

Bases: MixinTrapezes, Parameter

The individual area of each trapeze [m].

Required by the methods:

Calc_WaterDepth_V2 Use_WettedArea_V1

The highest trapeze has no upper neighbour and is thus infinitely large.

TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
update() None[source]

Calculate the perimeter derivatives based on \((BottomWidths + SlopeWidths / 2) \cdot TrapezeHeights\).

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(4)
>>> bottomlevels(1.0, 3.0, 4.0, 5.0)
>>> bottomwidths(2.0, 0.0, 2.0, 2.0)
>>> sideslopes(0.0, 2.0, 2.0, 2.0)
>>> derived.trapezeheights.update()
>>> derived.slopewidths.update()
>>> derived.trapezeareas.update()
>>> derived.trapezeareas
trapezeareas(4.0, 4.0, 10.0, inf)
name: str = 'trapezeareas'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_derived.PerimeterDerivatives(subvars: SubParameters)[source]

Bases: MixinTrapezes, Parameter

Change of the perimeter of each trapeze relative to a water level increase within the trapeze’s range [-].

TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
update() None[source]

Calculate the perimeter derivatives based on \(2 \cdot \sqrt{1 + SideSlopes^2}\).

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbtrapezes(2)
>>> sideslopes(0.0, 2.0)
>>> derived.perimeterderivatives.update()
>>> derived.perimeterderivatives
perimeterderivatives(2.0, 4.472136)
name: str = 'perimeterderivatives'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.wq.wq_derived.SectorFlowWidths(subvars: SubParameters)[source]

Bases: _SectorWidths

The sector-specific widths of those subareas of the cross section involved in water routing [m].

update() None[source]

Allocate the FlowWidths parts to the respective cross-section sectors.

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbwidths(9)
>>> nmbsectors(4)
>>> heights(1.0, 3.0, 4.0, 4.0, 4.0, 5.0, 6.0, 7.0, 8.0)
>>> flowwidths(2.0, 4.0, 6.0, 14.0, 18.0, 18.0, 24.0, 28.0, 30.0)
>>> transitions(2, 3, 5)
>>> derived.sectorflowwidths.update()
>>> derived.sectorflowwidths
sectorflowwidths([[2.0, 4.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0],
                  [0.0, 0.0, 0.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0],
                  [0.0, 0.0, 0.0, 0.0, 4.0, 4.0, 4.0, 4.0, 4.0],
                  [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 6.0, 10.0, 12.0]])
name: str = 'sectorflowwidths'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_derived.SectorTotalWidths(subvars: SubParameters)[source]

Bases: _SectorWidths

The sector-specific widths of the total cross section [m].

Required by the methods:

Calc_TotalAreas_V1 Calc_TotalWidths_V1 Use_WaterDepth_V3 Use_WaterLevel_V3

update() None[source]

Allocate the TotalWidths parts to the respective cross-section sectors.

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbwidths(9)
>>> nmbsectors(4)
>>> heights(1.0, 3.0, 4.0, 4.0, 4.0, 5.0, 6.0, 7.0, 8.0)
>>> totalwidths(2.0, 4.0, 6.0, 14.0, 18.0, 18.0, 24.0, 28.0, 30.0)
>>> transitions(2, 3, 5)
>>> derived.sectortotalwidths.update()
>>> derived.sectortotalwidths
sectortotalwidths([[2.0, 4.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0],
                   [0.0, 0.0, 0.0, 8.0, 8.0, 8.0, 8.0, 8.0, 8.0],
                   [0.0, 0.0, 0.0, 0.0, 4.0, 4.0, 4.0, 4.0, 4.0],
                   [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 6.0, 10.0, 12.0]])
name: str = 'sectortotalwidths'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_derived.SectorFlowAreas(subvars: SubParameters)[source]

Bases: _SectorAreas

The sector-specific wetted areas of those subareas of the cross section involved in water routing [m²].

update() None[source]

Calculate the cumulative sum of the individual trapeze areas defined by the height-width pairs of the individual sectors.

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbwidths(9)
>>> nmbsectors(4)
>>> heights(1.0, 3.0, 4.0, 4.0, 4.0, 5.0, 6.0, 7.0, 8.0)
>>> flowwidths(2.0, 4.0, 6.0, 14.0, 18.0, 18.0, 24.0, 28.0, 30.0)
>>> transitions(2, 3, 5)
>>> derived.sectorflowwidths.update()
>>> derived.sectorflowareas.update()
>>> derived.sectorflowareas
sectorflowareas([[0.0, 6.0, 11.0, 11.0, 11.0, 17.0, 23.0, 29.0, 35.0],
                 [0.0, 0.0, 0.0, 0.0, 0.0, 8.0, 16.0, 24.0, 32.0],
                 [0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 8.0, 12.0, 16.0],
                 [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 11.0, 22.0]])
name: str = 'sectorflowareas'

Name of the variable in lowercase letters.

unit: str = 'm²'

Unit of the variable.

class hydpy.models.wq.wq_derived.SectorTotalAreas(subvars: SubParameters)[source]

Bases: _SectorAreas

The sector-specific wetted areas of the total cross section [m²].

Required by the methods:

Calc_TotalAreas_V1 Use_WaterDepth_V3 Use_WaterLevel_V3

update() None[source]

Calculate the cumulative sum of the individual trapeze areas defined by the height-width pairs of the individual sectors.

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbwidths(9)
>>> nmbsectors(4)
>>> heights(1.0, 3.0, 4.0, 4.0, 4.0, 5.0, 6.0, 7.0, 8.0)
>>> totalwidths(2.0, 4.0, 6.0, 14.0, 18.0, 18.0, 24.0, 28.0, 30.0)
>>> transitions(2, 3, 5)
>>> derived.sectortotalwidths.update()
>>> derived.sectortotalareas.update()
>>> derived.sectortotalareas
sectortotalareas([[0.0, 6.0, 11.0, 11.0, 11.0, 17.0, 23.0, 29.0, 35.0],
                  [0.0, 0.0, 0.0, 0.0, 0.0, 8.0, 16.0, 24.0, 32.0],
                  [0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 8.0, 12.0, 16.0],
                  [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 11.0, 22.0]])
name: str = 'sectortotalareas'

Name of the variable in lowercase letters.

unit: str = 'm²'

Unit of the variable.

class hydpy.models.wq.wq_derived.SectorFlowPerimeters(subvars: SubParameters)[source]

Bases: MixinSectorsAndWidths, Parameter

The sector-specific wetted perimeters of those subareas of the cross section involved in water routing [m].

TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
update() None[source]

Calculate the cumulative sum of the individual trapeze perimeters defined by the height-width pairs of the individual sectors.

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbwidths(9)
>>> nmbsectors(4)
>>> heights(1.0, 3.0, 4.0, 4.0, 4.0, 5.0, 6.0, 7.0, 8.0)
>>> flowwidths(2.0, 4.0, 6.0, 14.0, 18.0, 18.0, 24.0, 28.0, 30.0)
>>> transitions(2, 3, 5)
>>> derived.sectorflowwidths.update()
>>> derived.sectorflowperimeters.update()
>>> derived.sectorflowperimeters
sectorflowperimeters([[2.0, 6.472136, 9.300563, 9.300563, 9.300563,
                       11.300563, 13.300563, 15.300563, 17.300563],
                      [0.0, 0.0, 0.0, 8.0, 8.0, 10.0, 12.0, 14.0, 16.0],
                      [0.0, 0.0, 0.0, 0.0, 4.0, 6.0, 8.0, 10.0, 12.0],
                      [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 6.324555,
                       10.796691, 13.625118]])
name: str = 'sectorflowperimeters'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_derived.SectorFlowPerimeterDerivatives(subvars: SubParameters)[source]

Bases: MixinSectorsAndWidths, Parameter

The sector-specific changes in the wetted perimeters of those subareas of the cross section involved in water routing with respect to water level increases [m].

TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
update() None[source]

Calculate the flow perimeter derivatives based on \(2 \cdot \sqrt{1 + (dw/dh/2)^2}\).

>>> from hydpy.models.wq import *
>>> parameterstep()
>>> nmbwidths(9)
>>> nmbsectors(4)
>>> heights(1.0, 3.0, 4.0, 4.0, 4.0, 5.0, 6.0, 7.0, 8.0)
>>> flowwidths(2.0, 4.0, 6.0, 14.0, 18.0, 18.0, 24.0, 28.0, 30.0)
>>> transitions(2, 3, 5)
>>> derived.sectorflowwidths.update()
>>> derived.sectorflowperimeterderivatives.update()
>>> derived.sectorflowperimeterderivatives
sectorflowperimeterderivatives([[2.236068, 2.828427, 2.0, 2.0, 2.0, 2.0,
                                 2.0, 2.0, 2.0],
                                [nan, nan, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
                                 2.0],
                                [nan, nan, nan, 2.0, 2.0, 2.0, 2.0, 2.0,
                                 2.0],
                                [nan, nan, nan, nan, nan, 6.324555,
                                 4.472136, 2.828427, 2.0]])
name: str = 'sectorflowperimeterderivatives'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_derived.CrestHeightRegularisation(subvars: SubParameters)[source]

Bases: Parameter

Regularisation parameter related to the difference between the water depth and the crest height [m].

Required by the method:

Calculate_Discharge_V1

NDIM: int = 0
TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
update() None[source]

Calculate the smoothing parameter value.

The documentation on module smoothtools explains the following example in some detail:

>>> from hydpy.models.wq import *
>>> from hydpy.cythons.smoothutils import smooth_logistic2
>>> from hydpy import round_
>>> parameterstep()
>>> crestheighttolerance(0.0)
>>> derived.crestheightregularisation.update()
>>> round_(smooth_logistic2(0.0, derived.crestheightregularisation))
0.0
>>> crestheighttolerance(0.0025)
>>> derived.crestheightregularisation.update()
>>> round_(smooth_logistic2(0.0025, derived.crestheightregularisation))
0.00251
name: str = 'crestheightregularisation'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

Sequence Features

Factor sequences

class hydpy.models.wq.FactorSequences(master: Sequences, cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)

Bases: FactorSequences

Factor sequences of model wq.

The following classes are selected:
  • WaterDepth() Water depth [m].

  • WaterLevel() Water level [m].

  • WettedAreas() Wetted area of each trapeze range [m²].

  • WettedArea() Total wetted area [m²].

  • FlowAreas() The sector-specific wetted areas of those subareas of the cross section involved in water routing [m²].

  • FlowArea() The total wetted area of those subareas of the cross section involved in water routing [m²].

  • TotalAreas() The sector-specific wetted areas of the total cross section [m²].

  • TotalArea() The total wetted area of the total cross section [m²].

  • WettedPerimeters() Wetted perimeter of each trapeze range [m].

  • FlowPerimeters() The sector-specific wetted perimeters of those subareas of the cross section involved in water routing [m].

  • WettedPerimeter() Total wetted perimeter [m].

  • WettedPerimeterDerivatives() Change in the wetted perimeter of each trapeze range with respect to a water level increase [-].

  • FlowPerimeterDerivatives() The sector-specific wetted perimeters of those subareas of the cross section involved in water routing [m].

  • SurfaceWidths() Surface width of each trapeze range [m].

  • SurfaceWidth() Total surface width [m].

  • FlowWidths() The sector-specific widths of those subareas of the cross section involved in water routing [m].

  • TotalWidths() The sector-specific widths of the total cross section [m].

  • TotalWidth() The total width of the total cross section [m].

  • DischargeDerivatives() Discharge change of each trapeze range with respect to a water level increase [m²/s].

  • DischargeDerivative() Total discharge change with respect to a water level increase [m²/s].

  • Celerity() Kinematic celerity (wave speed) [m/s].

class hydpy.models.wq.wq_factors.WaterDepth(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: FactorSequence

Water depth [m].

Calculated by the methods:

Calc_WaterDepth_V1 Calc_WaterDepth_V2 Calc_WaterDepth_V3 Set_WaterDepth_V1 Use_WaterDepth_V1 Use_WaterDepth_V2 Use_WaterDepth_V3 Use_WaterLevel_V1 Use_WaterLevel_V2 Use_WaterLevel_V3 Use_WettedArea_V1

Required by the methods:

Calc_DischargeDerivatives_V1 Calc_Discharges_V1 Calc_SurfaceWidths_V1 Calc_WaterLevel_V1 Calc_WaterLevel_V2 Calc_WettedAreas_V1 Calc_WettedPerimeterDerivatives_V1 Calc_WettedPerimeters_V1 Get_WaterDepth_V1

NDIM: int = 0
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'waterdepth'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_factors.WaterLevel(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: FactorSequence

Water level [m].

Calculated by the methods:

Calc_WaterLevel_V1 Calc_WaterLevel_V2 Set_WaterLevel_V1 Use_WaterDepth_V1 Use_WaterDepth_V2 Use_WaterDepth_V3 Use_WaterLevel_V1 Use_WaterLevel_V2 Use_WaterLevel_V3 Use_WettedArea_V1

Required by the methods:

Calc_DischargeDerivatives_V2 Calc_Index_Excess_Weight_V1 Calc_WaterDepth_V1 Calc_WaterDepth_V3 Get_WaterLevel_V1

NDIM: int = 0
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (None, None)
name: str = 'waterlevel'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_factors.WettedAreas(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: MixinTrapezes, FactorSequence

Wetted area of each trapeze range [m²].

Calculated by the methods:

Calc_WettedAreas_V1 Use_WaterDepth_V1 Use_WaterDepth_V2 Use_WaterLevel_V1 Use_WaterLevel_V2 Use_WettedArea_V1

Required by the methods:

Calc_DischargeDerivatives_V1 Calc_Discharges_V1 Calc_WettedArea_V1

SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'wettedareas'

Name of the variable in lowercase letters.

unit: str = 'm²'

Unit of the variable.

class hydpy.models.wq.wq_factors.WettedArea(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: FactorSequence

Total wetted area [m²].

Calculated by the methods:

Calc_WettedArea_V1 Set_WettedArea_V1 Use_WaterDepth_V1 Use_WaterDepth_V2 Use_WaterLevel_V1 Use_WaterLevel_V2 Use_WettedArea_V1

Required by the methods:

Calc_WaterDepth_V2 Get_WettedArea_V1

NDIM: int = 0
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'wettedarea'

Name of the variable in lowercase letters.

unit: str = 'm²'

Unit of the variable.

class hydpy.models.wq.wq_factors.FlowAreas(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: MixinTrapezesOrSectors, FactorSequence

The sector-specific wetted areas of those subareas of the cross section involved in water routing [m²].

SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'flowareas'

Name of the variable in lowercase letters.

unit: str = 'm²'

Unit of the variable.

class hydpy.models.wq.wq_factors.FlowArea(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: FactorSequence

The total wetted area of those subareas of the cross section involved in water routing [m²].

NDIM: int = 0
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'flowarea'

Name of the variable in lowercase letters.

unit: str = 'm²'

Unit of the variable.

class hydpy.models.wq.wq_factors.TotalAreas(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: MixinTrapezesOrSectors, FactorSequence

The sector-specific wetted areas of the total cross section [m²].

Calculated by the methods:

Calc_TotalAreas_V1 Use_WaterDepth_V3 Use_WaterLevel_V3

Required by the method:

Calc_TotalArea_V1

SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'totalareas'

Name of the variable in lowercase letters.

unit: str = 'm²'

Unit of the variable.

class hydpy.models.wq.wq_factors.TotalArea(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: FactorSequence

The total wetted area of the total cross section [m²].

Calculated by the methods:

Calc_TotalArea_V1 Use_WaterDepth_V3 Use_WaterLevel_V3

Required by the method:

Get_WettedArea_V2

NDIM: int = 0
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'totalarea'

Name of the variable in lowercase letters.

unit: str = 'm²'

Unit of the variable.

class hydpy.models.wq.wq_factors.WettedPerimeters(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: MixinTrapezes, FactorSequence

Wetted perimeter of each trapeze range [m].

Calculated by the methods:

Calc_WettedPerimeters_V1 Use_WaterDepth_V1 Use_WaterDepth_V2 Use_WaterLevel_V1 Use_WaterLevel_V2 Use_WettedArea_V1

Required by the methods:

Calc_DischargeDerivatives_V1 Calc_Discharges_V1 Calc_WettedPerimeter_V1

SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'wettedperimeters'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_factors.FlowPerimeters(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: MixinTrapezesOrSectors, FactorSequence

The sector-specific wetted perimeters of those subareas of the cross section involved in water routing [m].

SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'flowperimeters'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_factors.WettedPerimeter(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: FactorSequence

Total wetted perimeter [m].

Calculated by the methods:

Calc_WettedPerimeter_V1 Use_WaterDepth_V2 Use_WaterLevel_V2 Use_WettedArea_V1

Required by the method:

Get_WettedPerimeter_V1

NDIM: int = 0
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'wettedperimeter'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_factors.WettedPerimeterDerivatives(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: MixinTrapezes, FactorSequence

Change in the wetted perimeter of each trapeze range with respect to a water level increase [-].

SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'wettedperimeterderivatives'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.wq.wq_factors.FlowPerimeterDerivatives(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: MixinTrapezesOrSectors, FactorSequence

The sector-specific wetted perimeters of those subareas of the cross section involved in water routing [m].

SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'flowperimeterderivatives'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_factors.SurfaceWidths(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: MixinTrapezes, FactorSequence

Surface width of each trapeze range [m].

Calculated by the methods:

Calc_SurfaceWidths_V1 Use_WaterDepth_V1 Use_WaterLevel_V1

Required by the methods:

Calc_DischargeDerivatives_V1 Calc_SurfaceWidth_V1

SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'surfacewidths'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_factors.SurfaceWidth(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: FactorSequence

Total surface width [m].

Calculated by the methods:

Calc_SurfaceWidth_V1 Use_WaterDepth_V1 Use_WaterLevel_V1

Required by the methods:

Calc_Celerity_V1 Get_SurfaceWidth_V1

NDIM: int = 0
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'surfacewidth'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_factors.FlowWidths(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: MixinTrapezesOrSectors, FactorSequence

The sector-specific widths of those subareas of the cross section involved in water routing [m].

SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'flowwidths'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_factors.TotalWidths(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: MixinTrapezesOrSectors, FactorSequence

The sector-specific widths of the total cross section [m].

Calculated by the methods:

Calc_TotalWidths_V1 Use_WaterDepth_V3 Use_WaterLevel_V3

Required by the methods:

Calc_TotalAreas_V1 Calc_TotalWidth_V1

SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'totalwidths'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_factors.TotalWidth(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: FactorSequence

The total width of the total cross section [m].

Calculated by the methods:

Calc_TotalWidth_V1 Use_WaterDepth_V3 Use_WaterLevel_V3

Required by the methods:

Calc_Celerity_V2 Get_SurfaceWidth_V2

NDIM: int = 0
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'totalwidth'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_factors.DischargeDerivatives(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: MixinTrapezesOrSectors, FactorSequence

Discharge change of each trapeze range with respect to a water level increase [m²/s].

NUMERIC: bool = False
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (None, None)
name: str = 'dischargederivatives'

Name of the variable in lowercase letters.

unit: str = 'm²/s'

Unit of the variable.

class hydpy.models.wq.wq_factors.DischargeDerivative(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: FactorSequence

Total discharge change with respect to a water level increase [m²/s].

Calculated by the methods:

Calc_DischargeDerivative_V1 Calc_DischargeDerivative_V2 Use_WaterDepth_V1 Use_WaterDepth_V3 Use_WaterLevel_V1 Use_WaterLevel_V3

Required by the methods:

Calc_Celerity_V1 Calc_Celerity_V2

NDIM: int = 0
NUMERIC: bool = False
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (None, None)
name: str = 'dischargederivative'

Name of the variable in lowercase letters.

unit: str = 'm²/s'

Unit of the variable.

class hydpy.models.wq.wq_factors.Celerity(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: FactorSequence

Kinematic celerity (wave speed) [m/s].

Calculated by the methods:

Calc_Celerity_V1 Calc_Celerity_V2 Use_WaterDepth_V1 Use_WaterDepth_V3 Use_WaterLevel_V1 Use_WaterLevel_V3

Required by the method:

Get_Celerity_V1

NDIM: int = 0
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (None, None)
name: str = 'celerity'

Name of the variable in lowercase letters.

unit: str = 'm/s'

Unit of the variable.

Flux sequences

class hydpy.models.wq.FluxSequences(master: Sequences, cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)

Bases: FluxSequences

Flux sequences of model wq.

The following classes are selected:
class hydpy.models.wq.wq_fluxes.Discharges(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: MixinTrapezesOrSectors, FluxSequence

The discharge of each trapeze range [m³/s].

Calculated by the methods:

Calc_Discharges_V1 Calc_Discharges_V2 Use_WaterDepth_V1 Use_WaterDepth_V3 Use_WaterLevel_V1 Use_WaterLevel_V3

Required by the methods:

Calc_Discharge_V2 Calc_Discharge_V3

NUMERIC: bool = False
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (None, None)
name: str = 'discharges'

Name of the variable in lowercase letters.

unit: str = 'm³/s'

Unit of the variable.

class hydpy.models.wq.wq_fluxes.Discharge(subvars: ModelIOSequences[ModelIOSequence, FastAccessIOSequence])[source]

Bases: FluxSequence

Total discharge [m³/s].

Calculated by the methods:

Calc_Discharge_V2 Calc_Discharge_V3 Use_WaterDepth_V1 Use_WaterDepth_V3 Use_WaterLevel_V1 Use_WaterLevel_V3

Required by the method:

Get_Discharge_V1

NDIM: int = 0
NUMERIC: bool = False
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (None, None)
name: str = 'discharge'

Name of the variable in lowercase letters.

unit: str = 'm³/s'

Unit of the variable.

Aide sequences

class hydpy.models.wq.AideSequences(master: Sequences, cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)

Bases: AideSequences

Aide sequences of model wq.

The following classes are selected:
  • Index() Index of the measured height directly below the current height [-].

  • Excess() Difference between the current height and the next-lower measured height [m].

  • Weight() Linear weighting factor that is zero if the current height equals the next-lower measured height and one if it equals the next-higher measured height [-].

class hydpy.models.wq.wq_aides.Index(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: AideSequence

Index of the measured height directly below the current height [-].

Calculated by the methods:

Calc_Index_Excess_Weight_V1 Use_WaterDepth_V3 Use_WaterLevel_V3

Required by the methods:

Calc_FlowAreas_V1 Calc_FlowPerimeterDerivatives_V1 Calc_FlowPerimeters_V1 Calc_FlowWidths_V1 Calc_TotalAreas_V1 Calc_TotalWidths_V1

NDIM: int = 0
NUMERIC: bool = False
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'index'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.wq.wq_aides.Excess(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: AideSequence

Difference between the current height and the next-lower measured height [m].

Calculated by the methods:

Calc_Index_Excess_Weight_V1 Use_WaterDepth_V3 Use_WaterLevel_V3

Required by the methods:

Calc_FlowAreas_V1 Calc_FlowPerimeters_V1 Calc_TotalAreas_V1

NDIM: int = 0
NUMERIC: bool = False
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, None)
name: str = 'excess'

Name of the variable in lowercase letters.

unit: str = 'm'

Unit of the variable.

class hydpy.models.wq.wq_aides.Weight(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: AideSequence

Linear weighting factor that is zero if the current height equals the next-lower measured height and one if it equals the next-higher measured height [-].

NDIM: int = 0
NUMERIC: bool = False
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (0.0, 1.0)
name: str = 'weight'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.wq.AideSequences(master: Sequences, cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)

Bases: AideSequences

Aide sequences of model wq.

The following classes are selected:
  • Index() Index of the measured height directly below the current height [-].

  • Excess() Difference between the current height and the next-lower measured height [m].

  • Weight() Linear weighting factor that is zero if the current height equals the next-lower measured height and one if it equals the next-higher measured height [-].

class hydpy.models.wq.ControlParameters(master: Parameters, cls_fastaccess: type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)

Bases: SubParameters

Control parameters of model wq.

The following classes are selected:
class hydpy.models.wq.DerivedParameters(master: Parameters, cls_fastaccess: type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)

Bases: SubParameters

Derived parameters of model wq.

The following classes are selected:
  • BottomDepths() The cumulated depth of a trapeze and its lower neighbours [m].

  • TrapezeHeights() The individual height of each trapeze [m].

  • SlopeWidths() The total width of both side slopes of each trapeze.

  • TrapezeAreas() The individual area of each trapeze [m].

  • PerimeterDerivatives() Change of the perimeter of each trapeze relative to a water level increase within the trapeze’s range [-].

  • SectorFlowWidths() The sector-specific widths of those subareas of the cross section involved in water routing [m].

  • SectorTotalWidths() The sector-specific widths of the total cross section [m].

  • SectorFlowAreas() The sector-specific wetted areas of those subareas of the cross section involved in water routing [m²].

  • SectorTotalAreas() The sector-specific wetted areas of the total cross section [m²].

  • SectorFlowPerimeters() The sector-specific wetted perimeters of those subareas of the cross section involved in water routing [m].

  • SectorFlowPerimeterDerivatives() The sector-specific changes in the wetted perimeters of those subareas of the cross section involved in water routing with respect to water level increases [m].

  • CrestHeightRegularisation() Regularisation parameter related to the difference between the water depth and the crest height [m].

class hydpy.models.wq.FactorSequences(master: Sequences, cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)

Bases: FactorSequences

Factor sequences of model wq.

The following classes are selected:
  • WaterDepth() Water depth [m].

  • WaterLevel() Water level [m].

  • WettedAreas() Wetted area of each trapeze range [m²].

  • WettedArea() Total wetted area [m²].

  • FlowAreas() The sector-specific wetted areas of those subareas of the cross section involved in water routing [m²].

  • FlowArea() The total wetted area of those subareas of the cross section involved in water routing [m²].

  • TotalAreas() The sector-specific wetted areas of the total cross section [m²].

  • TotalArea() The total wetted area of the total cross section [m²].

  • WettedPerimeters() Wetted perimeter of each trapeze range [m].

  • FlowPerimeters() The sector-specific wetted perimeters of those subareas of the cross section involved in water routing [m].

  • WettedPerimeter() Total wetted perimeter [m].

  • WettedPerimeterDerivatives() Change in the wetted perimeter of each trapeze range with respect to a water level increase [-].

  • FlowPerimeterDerivatives() The sector-specific wetted perimeters of those subareas of the cross section involved in water routing [m].

  • SurfaceWidths() Surface width of each trapeze range [m].

  • SurfaceWidth() Total surface width [m].

  • FlowWidths() The sector-specific widths of those subareas of the cross section involved in water routing [m].

  • TotalWidths() The sector-specific widths of the total cross section [m].

  • TotalWidth() The total width of the total cross section [m].

  • DischargeDerivatives() Discharge change of each trapeze range with respect to a water level increase [m²/s].

  • DischargeDerivative() Total discharge change with respect to a water level increase [m²/s].

  • Celerity() Kinematic celerity (wave speed) [m/s].

class hydpy.models.wq.FluxSequences(master: Sequences, cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)

Bases: FluxSequences

Flux sequences of model wq.

The following classes are selected: