hbranch_v1

Version 1 of the HydPy-H-Branch model allows branching the summed input from some inlet nodes to an arbitrary number of outlet nodes. The original HBV96 implementation supposes to separate inflowing discharge, but hbranch_v1 is suitable for separating arbitrary variables. Calculations are performed for each branch individually by linear interpolation (or extrapolation) following tabulated supporting points. Additionally, hbranch_v1 allows adjusting the input data with differences that can vary monthly.

Integration tests

Note

When new to HydPy, consider reading section How to understand integration tests? first.

We perform the following examples over a simulation period of 11 hours:

>>> from hydpy import pub, Nodes, Element
>>> pub.timegrids = "01.01.2000 00:00", "01.01.2000 11:00", "1h"

hbranch_v1 has no parameter with values depending on the simulation step size, which is why we can pass anything (or nothing) to function parameterstep() without changing the following results:

>>> from hydpy.models.hbranch_v1 import *
>>> parameterstep()

The hbranch_v1 model queries inflow from two inlet Node objects and passes the branched outflow to three outlet Node objects. Thus, In contrast to most other application models, we need to define the parameter values before connecting the model to its Element object, called branch:

>>> nodes = Nodes("input1", "input2", "output1", "output2", "output3")
>>> branch = Element("branch",
...                  inlets=["input1", "input2"],
...                  outlets=["output1", "output2", "output3"])
>>> delta(-1.0)
>>> minimum(-1.0)
>>> xpoints(0.0, 2.0, 4.0, 6.0)
>>> ypoints(output1=[0.0, 1.0, 2.0, 3.0],
...         output2=[0.0, 1.0, 0.0, 0.0],
...         output3=[0.0, 0.0, 2.0, 6.0])
>>> branch.model = model

We do not have to define any initial values in the test settings because the hbranch_v1 has no memory:

>>> from hydpy.core.testtools import IntegrationTest
>>> test = IntegrationTest(branch)
>>> test.dateformat = "%H:%M"

The (identical) values of the inlet nodes input1 and input2 define no realistic inflow series. Instead, they serve to show the behaviour of hbranch_v1 within and outside the current range defined by parameter XPoints:

>>> import numpy
>>> nodes.input1.sequences.sim.series = numpy.arange(-1.0, 10.0)/2
>>> nodes.input2.sequences.sim.series = numpy.arange(-1.0, 10.0)/2

output1 shows linear continuations below and above the current range of parameter XPoints. output2 points out that inverse relationships are allowed. output3 shows that hbranch_v1 does not enforce equality between the total sum of input and output values:

>>> test("hbranch_v1_ex1")
Click to see the table
Click to see the graph
class hydpy.models.hbranch_v1.Model[source]

Bases: Model

The HBV96 version of HydPy-H-Stream (hbranch_v1).

The following “inlet update methods” are called in the given sequence at the beginning of each simulation step:
The following “run methods” are called in the given sequence during each simulation step:
The following “outlet update methods” are called in the given sequence at the end of each simulation step:
class hydpy.models.hbranch_v1.ControlParameters(master: Parameters, cls_fastaccess: Type[FastAccessParameter] | None = None, cymodel: CyModelProtocol | None = None)

Bases: SubParameters

Control parameters of model hbranch_v1.

The following classes are selected:
  • Delta() Monthly varying difference for increasing or decreasing the input [e.g. m³/s].

  • Minimum() The allowed minimum value of the adjusted input [e.g. m³/s].

  • XPoints() Supporting points for the independent input variable [e.g. m³/s].

  • YPoints() Supporting points for the dependent output variables [e.g. m³/s].

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

Bases: SubParameters

Derived parameters of model hbranch_v1.

The following classes are selected:
  • MOY() References the “global” month of the year index array [-].

  • NmbBranches() The number of branches [-].

  • NmbPoints() The number of supporting points for linear interpolation [-].

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

Bases: FluxSequences

Flux sequences of model hbranch_v1.

The following classes are selected:
class hydpy.models.hbranch_v1.InletSequences(master: Sequences, cls_fastaccess: Type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)

Bases: InletSequences

Inlet sequences of model hbranch_v1.

The following classes are selected:
  • Total() Total input [e.g. m³/s].

class hydpy.models.hbranch_v1.OutletSequences(master: Sequences, cls_fastaccess: Type[TypeFastAccess_co] | None = None, cymodel: CyModelProtocol | None = None)

Bases: OutletSequences

Outlet sequences of model hbranch_v1.

The following classes are selected: