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,SubmodelInterfaceHydPy-WQ (base model).
- The following interface methods are available to main models using the defined model as a submodel:
Calculate_Discharge_V1Calculate the discharge based on the water depth given in m according to Brauer et al. (2014) and return it in mm/T.Set_WaterDepth_V1Set the water depth in m.Set_WaterLevel_V1Set the water level in m.Set_WettedArea_V1Set the wetted area in m².Use_WaterDepth_V1Set the water depth in m and use it to calculate all other properties.Use_WaterDepth_V2Set the water depth in m and use it to calculate all other properties.Use_WaterLevel_V1Set the water level in m and use it to calculate all other properties.Use_WaterLevel_V2Set the water level in m and use it to calculate all other properties.Use_WettedArea_V1Set the wetted area in m² and use it to calculate all other properties.Get_WaterDepth_V1Get the water depth in m.Get_WaterLevel_V1Get the water level in m.Get_WettedArea_V1Get the wetted area in m².Get_WettedPerimeter_V1Get the wetted perimeter in m.Get_SurfaceWidth_V1Get the surface width in m.Get_Discharge_V1Get the discharge in m³/s.Get_Celerity_V1Get the wave celerity in m/s.
- 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:
Calc_WaterDepth_V1Calculate the water depth based on the current water level.Calc_WaterDepth_V2Calculate the water depth based on the current wetted area.Calc_WaterLevel_V1Calculate the water level based on the current water depth.Calc_WettedAreas_V1Calculate the wetted area for each trapeze range.Calc_WettedArea_V1Sum up the individual trapeze ranges’ wetted areas.Calc_WettedPerimeters_V1Calculate the wetted perimeter for each trapeze range.Calc_WettedPerimeter_V1Sum up the individual trapeze ranges’ wetted perimeters.Calc_WettedPerimeterDerivatives_V1Calculate the change in the wetted perimeter of each trapeze range with respect to the water level increase.Calc_SurfaceWidths_V1Calculate the surface width for each trapeze range.Calc_SurfaceWidth_V1Sum the individual trapeze ranges’ surface widths.Calc_Discharges_V1Calculate the discharge for each trapeze range.Calc_Discharge_V2Sum the individual trapeze ranges’ discharges.Calc_DischargeDerivatives_V1Calculate the discharge change for each trapeze range with respect to a water level increase.Calc_DischargeDerivative_V1Sum the individual trapeze ranges’ discharge derivatives.Calc_Celerity_V1Calculate the kinematic wave celerity.
- REUSABLE_METHODS: ClassVar[tuple[type[ReusableMethod], ...]] = ()¶
- class hydpy.models.wq.wq_model.Calculate_Discharge_V1[source]¶
Bases:
MethodCalculate 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:
ChannelDepthCrestHeightBankfullDischargeDischargeExponent- Requires the derived parameter:
- 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:
MethodCalculate the water depth based on the current water level.
- Required by the methods:
- Requires the control parameter:
- Requires the factor sequence:
- Calculates the factor sequence:
- 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:
MethodCalculate the water depth based on the current wetted area.
- Required by the method:
- Requires the control parameters:
- Requires the derived parameters:
- Requires the factor sequence:
- Calculates the factor sequence:
- 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_V2as an inverse method ofCalc_WettedAreas_V1(andCalc_WettedArea_V1). Hence, the following convenience function allows the creation of examples that are directly comparable to those on methodCalc_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, methodCalc_WaterDepth_V2finds 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_WaterLevel_V1[source]¶
Bases:
MethodCalculate the water level based on the current water depth.
- Required by the methods:
- Requires the control parameter:
- Requires the factor sequence:
- Calculates the factor sequence:
- 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_WettedAreas_V1[source]¶
Bases:
MethodCalculate the wetted area for each trapeze range.
- Required by the methods:
Use_WaterDepth_V1Use_WaterDepth_V2Use_WaterLevel_V1Use_WaterLevel_V2Use_WettedArea_V1- Requires the control parameters:
- Requires the derived parameters:
- Requires the factor sequence:
- Calculates the factor sequence:
- 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_V1for 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_WettedArea_V1[source]¶
Bases:
MethodSum up the individual trapeze ranges’ wetted areas.
- Required by the methods:
Use_WaterDepth_V1Use_WaterDepth_V2Use_WaterLevel_V1Use_WaterLevel_V2Use_WettedArea_V1- Requires the control parameter:
- Requires the factor sequence:
- Calculates the factor sequence:
- 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_WettedPerimeters_V1[source]¶
Bases:
MethodCalculate the wetted perimeter for each trapeze range.
- Required by the methods:
Use_WaterDepth_V1Use_WaterDepth_V2Use_WaterLevel_V1Use_WaterLevel_V2Use_WettedArea_V1- Requires the control parameters:
- Requires the derived parameters:
- Requires the factor sequence:
- Calculates the factor sequence:
- 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_V1for 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_V1adds 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_WettedPerimeter_V1[source]¶
Bases:
MethodSum up the individual trapeze ranges’ wetted perimeters.
- Required by the methods:
- Requires the control parameter:
- Requires the factor sequence:
- Calculates the factor sequence:
- 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:
MethodCalculate the change in the wetted perimeter of each trapeze range with respect to the water level increase.
- Required by the methods:
- Requires the control parameter:
- Requires the derived parameters:
- Requires the factor sequence:
- Calculates the factor sequence:
- 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_V1for 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_V1adds 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_SurfaceWidths_V1[source]¶
Bases:
MethodCalculate the surface width for each trapeze range.
- Required by the methods:
- Requires the control parameters:
- Requires the derived parameters:
- Requires the factor sequence:
- Calculates the factor sequence:
- 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_V1for 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:
MethodSum the individual trapeze ranges’ surface widths.
- Required by the methods:
- Requires the control parameter:
- Requires the factor sequence:
- Calculates the factor sequence:
- Basic equation:
\(SurfaceWidth = \sum_{i=1}^{NmbTrapezes} SurfaceWidths_i\)
Examples:
>>> from hydpy.models.wq import * >>> parameterstep() >>> nmbtrapezes(3) >>> bottomslope(0.01) >>> factors.surfacewidths(2.0, 3.0, 1.0) >>> model.calc_surfacewidth_v1() >>> factors.surfacewidth surfacewidth(6.0)
- class hydpy.models.wq.wq_model.Calc_Discharges_V1[source]¶
Bases:
MethodCalculate the discharge for each trapeze range.
- Required by the methods:
- Requires the control parameters:
- Requires the derived parameter:
- Requires the factor sequences:
- Calculates the flux sequence:
- 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_Discharge_V2[source]¶
Bases:
MethodSum the individual trapeze ranges’ discharges.
- Required by the methods:
- Requires the control parameter:
- Requires the flux sequence:
- Calculates the flux sequence:
- Basic equation:
\(Discharge = \sum_{i=1}^{NmbTrapezes} Discharges_i\)
Example:
>>> from hydpy.models.wq import * >>> parameterstep() >>> nmbtrapezes(3) >>> bottomslope(0.01) >>> fluxes.discharges(2.0, 3.0, 1.0) >>> model.calc_discharge_v2() >>> fluxes.discharge discharge(6.0)
- class hydpy.models.wq.wq_model.Calc_DischargeDerivatives_V1[source]¶
Bases:
MethodCalculate the discharge change for each trapeze range with respect to a water level increase.
- Required by the methods:
- Requires the control parameters:
- Requires the derived parameter:
- Requires the factor sequences:
WaterDepthWettedAreasWettedPerimetersWettedPerimeterDerivativesSurfaceWidths- Calculates the factor sequence:
- 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, andCalc_WettedPerimeterDerivatives_V1. Hence, we apply these methods and check that, after also executingCalc_DischargeDerivatives_V1, the results are sufficiently similar to the numerical approximations gained when applyingNumericalDifferentiatorto the mentioned methods and methodCalc_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_DischargeDerivative_V1[source]¶
Bases:
MethodSum the individual trapeze ranges’ discharge derivatives.
- Required by the methods:
- Requires the control parameter:
- Requires the factor sequence:
- Calculates the factor sequence:
- 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_Celerity_V1[source]¶
Bases:
MethodCalculate the kinematic wave celerity.
- Required by the methods:
- Requires the factor sequences:
- Calculates the factor sequence:
- 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.Set_WaterDepth_V1[source]¶
Bases:
MethodSet the water depth in m.
- Required by the methods:
- Calculates the factor sequence:
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:
MethodSet the water level in m.
- Required by the methods:
- Calculates the factor sequence:
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:
MethodSet the wetted area in m².
- Required by the method:
- Calculates the factor sequence:
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:
SetAutoMethodSet the water depth in m and use it to calculate all other properties.
- Required submethods:
Set_WaterDepth_V1Calc_WaterLevel_V1Calc_WettedAreas_V1Calc_WettedArea_V1Calc_WettedPerimeters_V1Calc_WettedPerimeterDerivatives_V1Calc_SurfaceWidths_V1Calc_SurfaceWidth_V1Calc_Discharges_V1Calc_Discharge_V2Calc_DischargeDerivatives_V1Calc_DischargeDerivative_V1Calc_Celerity_V1- Requires the control parameters:
NmbTrapezesBottomLevelsBottomWidthsSideSlopesStricklerCoefficientsBottomSlope- Requires the derived parameters:
BottomDepthsTrapezeHeightsSlopeWidthsPerimeterDerivatives- Calculates the factor sequences:
WaterDepthWaterLevelWettedAreasWettedAreaWettedPerimetersWettedPerimeterDerivativesSurfaceWidthsSurfaceWidthDischargeDerivativesDischargeDerivativeCelerity- Calculates the flux sequences:
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:
SetAutoMethodSet the water depth in m and use it to calculate all other properties.
- Required submethods:
Set_WaterDepth_V1Calc_WaterLevel_V1Calc_WettedAreas_V1Calc_WettedArea_V1Calc_WettedPerimeters_V1Calc_WettedPerimeter_V1- Requires the control parameters:
- Requires the derived parameters:
- Calculates the factor sequences:
WaterDepthWaterLevelWettedAreasWettedAreaWettedPerimetersWettedPerimeter
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_WaterLevel_V1[source]¶
Bases:
SetAutoMethodSet the water level in m and use it to calculate all other properties.
- Required submethods:
Set_WaterLevel_V1Calc_WaterDepth_V1Calc_WettedAreas_V1Calc_WettedArea_V1Calc_WettedPerimeters_V1Calc_WettedPerimeterDerivatives_V1Calc_SurfaceWidths_V1Calc_SurfaceWidth_V1Calc_Discharges_V1Calc_Discharge_V2Calc_DischargeDerivatives_V1Calc_DischargeDerivative_V1Calc_Celerity_V1- Requires the control parameters:
NmbTrapezesBottomLevelsBottomWidthsSideSlopesStricklerCoefficientsBottomSlope- Requires the derived parameters:
BottomDepthsTrapezeHeightsSlopeWidthsPerimeterDerivatives- Calculates the factor sequences:
WaterLevelWaterDepthWettedAreasWettedAreaWettedPerimetersWettedPerimeterDerivativesSurfaceWidthsSurfaceWidthDischargeDerivativesDischargeDerivativeCelerity- Calculates the flux sequences:
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:
SetAutoMethodSet the water level in m and use it to calculate all other properties.
- Required submethods:
Set_WaterLevel_V1Calc_WaterDepth_V1Calc_WettedAreas_V1Calc_WettedArea_V1Calc_WettedPerimeters_V1Calc_WettedPerimeter_V1- Requires the control parameters:
- Requires the derived parameters:
- Calculates the factor sequences:
WaterDepthWaterLevelWettedAreasWettedAreaWettedPerimetersWettedPerimeter
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_WettedArea_V1[source]¶
Bases:
SetAutoMethodSet the wetted area in m² and use it to calculate all other properties.
- Required submethods:
Set_WettedArea_V1Calc_WaterDepth_V2Calc_WaterLevel_V1Calc_WettedAreas_V1Calc_WettedArea_V1Calc_WettedPerimeters_V1Calc_WettedPerimeter_V1- Requires the control parameters:
- Requires the derived parameters:
- Calculates the factor sequences:
WaterDepthWaterLevelWettedAreasWettedAreaWettedPerimetersWettedPerimeter
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:
MethodGet the water depth in m.
- Requires the factor sequence:
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:
MethodGet the water level in m.
- Requires the factor sequence:
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:
MethodGet the wetted area in m².
- Requires the factor sequence:
Example:
>>> from hydpy.models.wq import * >>> parameterstep() >>> factors.wettedarea = 2.0 >>> model.get_wettedarea_v1() 2.0
- class hydpy.models.wq.wq_model.Get_WettedPerimeter_V1[source]¶
Bases:
MethodGet the wetted perimeter in m.
- Requires the factor sequence:
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:
MethodGet the surface width in m.
- Requires the factor sequence:
Example:
>>> from hydpy.models.wq import * >>> parameterstep() >>> factors.surfacewidth = 2.0 >>> model.get_surfacewidth_v1() 2.0
- class hydpy.models.wq.wq_model.Get_Discharge_V1[source]¶
Bases:
MethodGet the discharge in m³/s.
- Requires the flux sequence:
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:
MethodGet the wave celerity in m/s.
- Requires the factor sequence:
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:
AdHocModelBase 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 application model
wq_trapezefor more information.
- REUSABLE_METHODS: ClassVar[tuple[type[ReusableMethod], ...]] = ()¶
- class hydpy.models.wq.wq_model.Base_DischargeModel_V2[source]¶
Bases:
DischargeModel_V2Base class for HydPy-WQ models that comply with the
DischargeModel_V2submodel 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], ...]] = ()¶
- cymodel: CyModelProtocol | None¶
- parameters: parametertools.Parameters¶
- sequences: sequencetools.Sequences¶
- masks: masktools.Masks¶
Parameter Features¶
Control parameters¶
- class hydpy.models.wq.ControlParameters(master: Parameters, cls_fastaccess: type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)
Bases:
SubParametersControl parameters of model wq.
- The following classes are selected:
NmbTrapezes()Number of trapezes defining the cross section [-].BottomLevels()The bottom level for each trapeze [m].BottomWidths()The bottom width for each trapeze [m].SideSlopes()The side slope for each trapeze[-].StricklerCoefficients()Manning-Strickler coefficient for each trapeze [m^(1/3)/s].BottomSlope()Bottom slope [-].ChannelDepth()Channel depth [m].CrestHeight()The height of the weir’s crest above the channel bottom [m].CrestHeightTolerance()Smoothing parameter related to the difference between the water depth and the crest height [m].BankfullDischarge()Bankfull discharge [mm/T].DischargeExponent()Exponent of the water depth-discharge relation [-].
- class hydpy.models.wq.wq_control.NmbTrapezes(subvars: SubParameters)[source]¶
Bases:
ParameterNumber of trapezes defining the cross section [-].
- Required by the methods:
Calc_DischargeDerivative_V1Calc_DischargeDerivatives_V1Calc_Discharge_V2Calc_Discharges_V1Calc_SurfaceWidth_V1Calc_SurfaceWidths_V1Calc_WaterDepth_V2Calc_WettedArea_V1Calc_WettedAreas_V1Calc_WettedPerimeterDerivatives_V1Calc_WettedPerimeter_V1Calc_WettedPerimeters_V1Use_WaterDepth_V1Use_WaterDepth_V2Use_WaterLevel_V1Use_WaterLevel_V2Use_WettedArea_V1
- class hydpy.models.wq.wq_control.BottomLevels(subvars: SubParameters)[source]¶
Bases:
ParameterThe bottom level for each trapeze [m].
- Required by the methods:
Calc_WaterDepth_V1Calc_WaterLevel_V1Use_WaterDepth_V1Use_WaterDepth_V2Use_WaterLevel_V1Use_WaterLevel_V2Use_WettedArea_V1
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.
- class hydpy.models.wq.wq_control.BottomWidths(subvars: SubParameters)[source]¶
Bases:
ParameterThe bottom width for each trapeze [m].
- Required by the methods:
Calc_SurfaceWidths_V1Calc_WaterDepth_V2Calc_WettedAreas_V1Calc_WettedPerimeters_V1Use_WaterDepth_V1Use_WaterDepth_V2Use_WaterLevel_V1Use_WaterLevel_V2Use_WettedArea_V1
For example, when dealing with the second trapeze, the corresponding value of
BottomWidthsrepresents the sum of the trapeze’s partial bottoms on the left and right sides of the first trapeze.
- class hydpy.models.wq.wq_control.SideSlopes(subvars: SubParameters)[source]¶
Bases:
ParameterThe side slope for each trapeze[-].
- Required by the methods:
Calc_SurfaceWidths_V1Calc_WaterDepth_V2Calc_WettedAreas_V1Calc_WettedPerimeters_V1Use_WaterDepth_V1Use_WaterDepth_V2Use_WaterLevel_V1Use_WaterLevel_V2Use_WettedArea_V1
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.
- class hydpy.models.wq.wq_control.StricklerCoefficients(subvars: SubParameters)[source]¶
Bases:
ParameterManning-Strickler coefficient for each trapeze [m^(1/3)/s].
- Required by the methods:
Calc_DischargeDerivatives_V1Calc_Discharges_V1Use_WaterDepth_V1Use_WaterLevel_V1
The higher the coefficient’s value, the higher the calculated discharge. Typical values range from 20 to 80.
- class hydpy.models.wq.wq_control.BottomSlope(subvars: SubParameters)[source]¶
Bases:
ParameterBottom slope [-].
- Required by the methods:
Calc_DischargeDerivatives_V1Calc_Discharges_V1Use_WaterDepth_V1Use_WaterLevel_V1
\(BottomSlope = \frac{elevation_{start} - elevation_{end}}{length}\)
- class hydpy.models.wq.wq_control.ChannelDepth(subvars: SubParameters)[source]¶
Bases:
ParameterChannel depth [m].
- Required by the method:
- class hydpy.models.wq.wq_control.CrestHeight(subvars: SubParameters)[source]¶
Bases:
ParameterThe height of the weir’s crest above the channel bottom [m].
- Required by the method:
Set
CrestHeightto zero for channels without weirs.
- class hydpy.models.wq.wq_control.CrestHeightTolerance(subvars: SubParameters)[source]¶
Bases:
ParameterSmoothing parameter related to the difference between the water depth and the crest height [m].
- class hydpy.models.wq.wq_control.BankfullDischarge(subvars: SubParameters)[source]¶
Bases:
ParameterBankfull discharge [mm/T].
- Required by the method:
- class hydpy.models.wq.wq_control.DischargeExponent(subvars: SubParameters)[source]¶
Bases:
ParameterExponent of the water depth-discharge relation [-].
- Required by the method:
Derived parameters¶
- class hydpy.models.wq.DerivedParameters(master: Parameters, cls_fastaccess: type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)
Bases:
SubParametersDerived 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 tatal 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 [-].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:
ParameterThe cumulated depth of a trapeze and its lower neighbours [m].
- Required by the methods:
Calc_DischargeDerivatives_V1Calc_Discharges_V1Calc_SurfaceWidths_V1Calc_WettedAreas_V1Calc_WettedPerimeterDerivatives_V1Calc_WettedPerimeters_V1Use_WaterDepth_V1Use_WaterDepth_V2Use_WaterLevel_V1Use_WaterLevel_V2Use_WettedArea_V1
- class hydpy.models.wq.wq_derived.TrapezeHeights(subvars: SubParameters)[source]¶
Bases:
ParameterThe individual height of each trapeze [m].
- Required by the methods:
Calc_SurfaceWidths_V1Calc_WaterDepth_V2Calc_WettedAreas_V1Calc_WettedPerimeterDerivatives_V1Calc_WettedPerimeters_V1Use_WaterDepth_V1Use_WaterDepth_V2Use_WaterLevel_V1Use_WaterLevel_V2Use_WettedArea_V1
The highest trapeze has no upper neighbour and is thus infinitely high.
- update()[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)
- class hydpy.models.wq.wq_derived.SlopeWidths(subvars: SubParameters)[source]¶
Bases:
ParameterThe tatal width of both side slopes of each trapeze.
- Required by the methods:
Calc_SurfaceWidths_V1Calc_WaterDepth_V2Calc_WettedAreas_V1Use_WaterDepth_V1Use_WaterDepth_V2Use_WaterLevel_V1Use_WaterLevel_V2Use_WettedArea_V1
The highest trapeze has no upper neighbour and is thus infinitely high and potentially infinitely wide.
- update()[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)
- class hydpy.models.wq.wq_derived.TrapezeAreas(subvars: SubParameters)[source]¶
Bases:
ParameterThe individual area of each trapeze [m].
- Required by the methods:
The highest trapeze has no upper neighbour and is thus infinitely large.
- update()[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)
- class hydpy.models.wq.wq_derived.PerimeterDerivatives(subvars: SubParameters)[source]¶
Bases:
ParameterChange of the perimeter of each trapeze relative to a water level increase within the trapeze’s range [-].
- Required by the methods:
Calc_WettedPerimeterDerivatives_V1Use_WaterDepth_V1Use_WaterLevel_V1
- update()[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)
- class hydpy.models.wq.wq_derived.CrestHeightRegularisation(subvars: SubParameters)[source]¶
Bases:
ParameterRegularisation parameter related to the difference between the water depth and the crest height [m].
- Required by the method:
- update()[source]¶
Calculate the smoothing parameter value.
The documentation on module
smoothtoolsexplains 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
Sequence Features¶
Factor sequences¶
- class hydpy.models.wq.FactorSequences(master: Sequences, cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)
Bases:
FactorSequencesFactor 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²].WettedPerimeters()Wetted perimeter of each trapeze range [m].WettedPerimeter()Total wetted perimeter [m].WettedPerimeterDerivatives()Change in the wetted perimeter of each trapeze range with respect to a water level increase [-].SurfaceWidths()Surface width of each trapeze range [m].SurfaceWidth()Total surface width [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: ModelSequences[ModelSequence, FastAccess])[source]¶
Bases:
FactorSequenceWater depth [m].
- Calculated by the methods:
Calc_WaterDepth_V1Calc_WaterDepth_V2Set_WaterDepth_V1Use_WaterDepth_V1Use_WaterDepth_V2Use_WaterLevel_V1Use_WaterLevel_V2Use_WettedArea_V1- Required by the methods:
Calc_DischargeDerivatives_V1Calc_Discharges_V1Calc_SurfaceWidths_V1Calc_WaterLevel_V1Calc_WettedAreas_V1Calc_WettedPerimeterDerivatives_V1Calc_WettedPerimeters_V1Get_WaterDepth_V1
- class hydpy.models.wq.wq_factors.WaterLevel(subvars: ModelSequences[ModelSequence, FastAccess])[source]¶
Bases:
FactorSequenceWater level [m].
- Calculated by the methods:
Calc_WaterLevel_V1Set_WaterLevel_V1Use_WaterDepth_V1Use_WaterDepth_V2Use_WaterLevel_V1Use_WaterLevel_V2Use_WettedArea_V1- Required by the methods:
- class hydpy.models.wq.wq_factors.WettedAreas(subvars: ModelSequences[ModelSequence, FastAccess])[source]¶
Bases:
FactorSequenceWetted area of each trapeze range [m²].
- Calculated by the methods:
Calc_WettedAreas_V1Use_WaterDepth_V1Use_WaterDepth_V2Use_WaterLevel_V1Use_WaterLevel_V2Use_WettedArea_V1- Required by the methods:
Calc_DischargeDerivatives_V1Calc_Discharges_V1Calc_WettedArea_V1
- class hydpy.models.wq.wq_factors.WettedArea(subvars: ModelSequences[ModelSequence, FastAccess])[source]¶
Bases:
FactorSequenceTotal wetted area [m²].
- Calculated by the methods:
Calc_WettedArea_V1Set_WettedArea_V1Use_WaterDepth_V1Use_WaterDepth_V2Use_WaterLevel_V1Use_WaterLevel_V2Use_WettedArea_V1- Required by the methods:
- class hydpy.models.wq.wq_factors.WettedPerimeters(subvars: ModelSequences[ModelSequence, FastAccess])[source]¶
Bases:
FactorSequenceWetted perimeter of each trapeze range [m].
- Calculated by the methods:
Calc_WettedPerimeters_V1Use_WaterDepth_V1Use_WaterDepth_V2Use_WaterLevel_V1Use_WaterLevel_V2Use_WettedArea_V1- Required by the methods:
Calc_DischargeDerivatives_V1Calc_Discharges_V1Calc_WettedPerimeter_V1
- class hydpy.models.wq.wq_factors.WettedPerimeter(subvars: ModelSequences[ModelSequence, FastAccess])[source]¶
Bases:
FactorSequenceTotal wetted perimeter [m].
- Calculated by the methods:
Calc_WettedPerimeter_V1Use_WaterDepth_V2Use_WaterLevel_V2Use_WettedArea_V1- Required by the method:
- class hydpy.models.wq.wq_factors.WettedPerimeterDerivatives(subvars: ModelSequences[ModelSequence, FastAccess])[source]¶
Bases:
FactorSequenceChange in the wetted perimeter of each trapeze range with respect to a water level increase [-].
- Calculated by the methods:
Calc_WettedPerimeterDerivatives_V1Use_WaterDepth_V1Use_WaterLevel_V1- Required by the method:
- class hydpy.models.wq.wq_factors.SurfaceWidths(subvars: ModelSequences[ModelSequence, FastAccess])[source]¶
Bases:
FactorSequenceSurface width of each trapeze range [m].
- Calculated by the methods:
- Required by the methods:
- class hydpy.models.wq.wq_factors.SurfaceWidth(subvars: ModelSequences[ModelSequence, FastAccess])[source]¶
Bases:
FactorSequenceTotal surface width [m].
- Calculated by the methods:
- Required by the methods:
- class hydpy.models.wq.wq_factors.DischargeDerivatives(subvars: ModelSequences[ModelSequence, FastAccess])[source]¶
Bases:
FactorSequenceDischarge change of each trapeze range with respect to a water level increase [m²/s].
- Calculated by the methods:
Calc_DischargeDerivatives_V1Use_WaterDepth_V1Use_WaterLevel_V1- Required by the method:
- class hydpy.models.wq.wq_factors.DischargeDerivative(subvars: ModelSequences[ModelSequence, FastAccess])[source]¶
Bases:
FactorSequenceTotal discharge change with respect to a water level increase [m²/s].
- Calculated by the methods:
Calc_DischargeDerivative_V1Use_WaterDepth_V1Use_WaterLevel_V1- Required by the method:
- class hydpy.models.wq.wq_factors.Celerity(subvars: ModelSequences[ModelSequence, FastAccess])[source]¶
Bases:
FactorSequenceKinematic celerity (wave speed) [m/s].
- Calculated by the methods:
- Required by the method:
Flux sequences¶
- class hydpy.models.wq.FluxSequences(master: Sequences, cls_fastaccess: type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)
Bases:
FluxSequencesFlux sequences of model wq.
- The following classes are selected:
Discharges()The discharge of each trapeze range [m³/s].Discharge()Total discharge [m³/s].
- class hydpy.models.wq.wq_fluxes.Discharges(subvars: ModelSequences[ModelSequence, FastAccess])[source]¶
Bases:
FluxSequenceThe discharge of each trapeze range [m³/s].
- Calculated by the methods:
- Required by the method:
- class hydpy.models.wq.wq_fluxes.Discharge(subvars: ModelSequences[ModelSequence, FastAccess])[source]¶
Bases:
FluxSequenceTotal discharge [m³/s].
- Calculated by the methods:
- Required by the method:
- class hydpy.models.wq.ControlParameters(master: Parameters, cls_fastaccess: type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)¶
Bases:
SubParametersControl parameters of model wq.
- The following classes are selected:
NmbTrapezes()Number of trapezes defining the cross section [-].BottomLevels()The bottom level for each trapeze [m].BottomWidths()The bottom width for each trapeze [m].SideSlopes()The side slope for each trapeze[-].StricklerCoefficients()Manning-Strickler coefficient for each trapeze [m^(1/3)/s].BottomSlope()Bottom slope [-].ChannelDepth()Channel depth [m].CrestHeight()The height of the weir’s crest above the channel bottom [m].CrestHeightTolerance()Smoothing parameter related to the difference between the water depth and the crest height [m].BankfullDischarge()Bankfull discharge [mm/T].DischargeExponent()Exponent of the water depth-discharge relation [-].
- class hydpy.models.wq.DerivedParameters(master: Parameters, cls_fastaccess: type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)¶
Bases:
SubParametersDerived 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 tatal 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 [-].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:
FactorSequencesFactor 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²].WettedPerimeters()Wetted perimeter of each trapeze range [m].WettedPerimeter()Total wetted perimeter [m].WettedPerimeterDerivatives()Change in the wetted perimeter of each trapeze range with respect to a water level increase [-].SurfaceWidths()Surface width of each trapeze range [m].SurfaceWidth()Total surface width [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:
FluxSequencesFlux sequences of model wq.
- The following classes are selected:
Discharges()The discharge of each trapeze range [m³/s].Discharge()Total discharge [m³/s].