HydPy-ARMA (base model)

HydPy-ARMA (base model) provides features to implement flood routing models based on autoregressive (AR) and moving-average (MA) methods. Method Features —————

class hydpy.models.arma.arma_model.Model[source]

Bases: AdHocModel

HydPy-ARMA (base model).

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:
  • Calc_QPIn_V1 Calculate the input discharge portions of the different response functions.

  • Update_LogIn_V1 Refresh the input log sequence for the different MA processes.

  • Calc_QMA_V1 Calculate the discharge responses of the different MA processes.

  • Calc_QAR_V1 Calculate the discharge responses of the different AR processes.

  • Calc_QPOut_V1 Calculate the ARMA results for the different response functions.

  • Update_LogOut_V1 Refresh the log sequence for the different AR processes.

  • Calc_QOut_V1 Sum up the results of the different response functions.

The following “outlet update methods” are called in the given sequence at the end of each simulation step:
DOCNAME: DocName = ('ARMA', 'base model')
REUSABLE_METHODS: ClassVar[tuple[type[ReusableMethod], ...]] = ()
class hydpy.models.arma.arma_model.Calc_QPIn_V1[source]

Bases: Method

Calculate the input discharge portions of the different response functions.

Requires the derived parameters:

Nmb MaxQ DiffQ

Requires the flux sequence:

QIn

Calculates the flux sequence:

QPIn

Examples:

Initialise an arma model with three different response functions:

>>> from hydpy.models.arma import *
>>> parameterstep()
>>> derived.nmb = 3
>>> derived.maxq.shape = 3
>>> derived.diffq.shape = 2
>>> fluxes.qpin.shape = 3

Define the maximum discharge value of the respective response functions and their successive differences:

>>> derived.maxq(0.0, 2.0, 6.0)
>>> derived.diffq(2.0, 4.0)

The first seven examples deal with inflow values ranging from -1 to 12 m³/s (note that arma even routes negative discharges, which are below the 0 m²/s threshold):

>>> from hydpy import UnitTest
>>> test = UnitTest(
...     model, model.calc_qpin_v1,
...     last_example=7,
...     parseqs=(fluxes.qin, fluxes.qpin))
>>> test.nexts.qin = -1.0, 0.0, 1.0, 2.0, 4.0, 6.0, 12.0
>>> test()
| ex. |  qin |            qpin |
--------------------------------
|   1 | -1.0 | -1.0  0.0   0.0 |
|   2 |  0.0 |  0.0  0.0   0.0 |
|   3 |  1.0 |  1.0  0.0   0.0 |
|   4 |  2.0 |  2.0  0.0   0.0 |
|   5 |  4.0 |  2.0  2.0   0.0 |
|   6 |  6.0 |  2.0  4.0   0.0 |
|   7 | 12.0 |  2.0  4.0   6.0 |

The following two additional examples are demonstrate that method Calc_QPIn_V1 also functions properly if there is only one response function, wherefore there is no need to divide the total discharge:

>>> derived.nmb = 1
>>> derived.maxq.shape = 1
>>> derived.diffq.shape = 0
>>> fluxes.qpin.shape = 1
>>> derived.maxq(0.0)
>>> test = UnitTest(
...     model, model.calc_qpin_v1,
...     first_example=8, last_example=10,
...                 parseqs=(fluxes.qin,
...                          fluxes.qpin))
>>> test.nexts.qin = -1.0, 0.0, 12.0
>>> test()
| ex. |  qin | qpin |
---------------------
|   8 | -1.0 | -1.0 |
|   9 |  0.0 |  0.0 |
|  10 | 12.0 | 12.0 |
class hydpy.models.arma.arma_model.Update_LogIn_V1[source]

Bases: Method

Refresh the input log sequence for the different MA processes.

Requires the derived parameters:

Nmb MA_Order

Requires the flux sequence:

QPIn

Updates the log sequence:

LogIn

Example:

Assume there are three response functions, involving one, two and three MA coefficients respectively:

>>> from hydpy.models.arma import *
>>> parameterstep()
>>> derived.nmb(3)
>>> derived.ma_order.shape = 3
>>> derived.ma_order = 1, 2, 3
>>> fluxes.qpin.shape = 3
>>> logs.login.shape = (3, 3)

The “memory values” of the different MA processes are defined as follows (one row for each process):

>>> logs.login = ((1.0, nan, nan),
...               (2.0, 3.0, nan),
...               (4.0, 5.0, 6.0))

These are the new inflow discharge portions to be included into the memories of the different processes:

>>> fluxes.qpin = 7.0, 8.0, 9.0

Through applying method Update_LogIn_V1 all values already existing are shifted to the right (“into the past”). Values, which are no longer required due to the limited order or the different MA processes, are discarded. The new values are inserted in the first column:

>>> model.update_login_v1()
>>> logs.login
login([[7.0, nan, nan],
       [8.0, 2.0, nan],
       [9.0, 4.0, 5.0]])
class hydpy.models.arma.arma_model.Calc_QMA_V1[source]

Bases: Method

Calculate the discharge responses of the different MA processes.

Requires the derived parameters:

Nmb MA_Order MA_Coefs

Requires the log sequence:

LogIn

Calculates the flux sequence:

QMA

Examples:

Assume there are three response functions, involving one, two and three MA coefficients respectively:

>>> from hydpy.models.arma import *
>>> parameterstep()
>>> derived.nmb(3)
>>> derived.ma_order.shape = 3
>>> derived.ma_order = 1, 2, 3
>>> derived.ma_coefs.shape = (3, 3)
>>> logs.login.shape = (3, 3)
>>> fluxes.qma.shape = 3

The coefficients of the different MA processes are stored in separate rows of the 2-dimensional parameter ma_coefs:

>>> derived.ma_coefs = ((1.0, nan, nan),
...                     (0.8, 0.2, nan),
...                     (0.5, 0.3, 0.2))

The “memory values” of the different MA processes are defined as follows (one row for each process). The current values are stored in first column, the values of the last time step in the second column, and so on:

>>> logs.login = ((1.0, nan, nan),
...               (2.0, 3.0, nan),
...               (4.0, 5.0, 6.0))

Applying method Calc_QMA_V1 is equivalent to calculating the inner product of the different rows of both matrices:

>>> model.calc_qma_v1()
>>> fluxes.qma
qma(1.0, 2.2, 4.7)
class hydpy.models.arma.arma_model.Calc_QAR_V1[source]

Bases: Method

Calculate the discharge responses of the different AR processes.

Requires the derived parameters:

Nmb AR_Order AR_Coefs

Requires the log sequence:

LogOut

Calculates the flux sequence:

QAR

Examples:

Assume there are four response functions, involving zero, one, two, and three AR coefficients respectively:

>>> from hydpy.models.arma import *
>>> parameterstep()
>>> derived.nmb(4)
>>> derived.ar_order.shape = 4
>>> derived.ar_order = 0, 1, 2, 3
>>> derived.ar_coefs.shape = (4, 3)
>>> logs.logout.shape = (4, 3)
>>> fluxes.qar.shape = 4

The coefficients of the different AR processes are stored in separate rows of the 2-dimensional parameter ma_coefs. Note the special case of the first AR process of zero order (first row), which involves no autoregressive memory at all:

>>> derived.ar_coefs = ((nan, nan, nan),
...                     (1.0, nan, nan),
...                     (0.8, 0.2, nan),
...                     (0.5, 0.3, 0.2))

The “memory values” of the different AR processes are defined as follows (one row for each process). The values of the last time step are stored in first column, the values of the last time step in the second column, and so on:

>>> logs.logout = ((nan, nan, nan),
...                (1.0, nan, nan),
...                (2.0, 3.0, nan),
...                (4.0, 5.0, 6.0))

Applying method Calc_QAR_V1 is equivalent to calculating the inner product of the different rows of both matrices:

>>> model.calc_qar_v1()
>>> fluxes.qar
qar(0.0, 1.0, 2.2, 4.7)
class hydpy.models.arma.arma_model.Calc_QPOut_V1[source]

Bases: Method

Calculate the ARMA results for the different response functions.

Requires the derived parameter:

Nmb

Requires the flux sequences:

QMA QAR

Calculates the flux sequence:

QPOut

Examples:

Initialize an arma model with three different response functions:

>>> from hydpy.models.arma import *
>>> parameterstep()
>>> derived.nmb(3)
>>> fluxes.qma.shape = 3
>>> fluxes.qar.shape = 3
>>> fluxes.qpout.shape = 3

Define the output values of the MA and of the AR processes associated with the three response functions and apply method Calc_QPOut_V1:

>>> fluxes.qar = 4.0, 5.0, 6.0
>>> fluxes.qma = 1.0, 2.0, 3.0
>>> model.calc_qpout_v1()
>>> fluxes.qpout
qpout(5.0, 7.0, 9.0)
class hydpy.models.arma.arma_model.Update_LogOut_V1[source]

Bases: Method

Refresh the log sequence for the different AR processes.

Requires the derived parameters:

Nmb AR_Order

Requires the flux sequence:

QPOut

Updates the log sequence:

LogOut

Example:

Assume there are four response functions, involving zero, one, two and three AR coefficients respectively:

>>> from hydpy.models.arma import *
>>> parameterstep()
>>> derived.nmb(4)
>>> derived.ar_order.shape = 4
>>> derived.ar_order = 0, 1, 2, 3
>>> fluxes.qpout.shape = 4
>>> logs.logout.shape = (4, 3)

The “memory values” of the different AR processes are defined as follows (one row for each process). Note the special case of the first AR process of zero order (first row), which is why there are no autoregressive memory values required:

>>> logs.logout = ((nan, nan, nan),
...                (0.0, nan, nan),
...                (1.0, 2.0, nan),
...                (3.0, 4.0, 5.0))

These are the new outflow discharge portions to be included into the memories of the different processes:

>>> fluxes.qpout = 6.0, 7.0, 8.0, 9.0

Through applying method Update_LogOut_V1 all values already existing are shifted to the right (“into the past”). Values, which are no longer required due to the limited order or the different AR processes, are discarded. The new values are inserted in the first column:

>>> model.update_logout_v1()
>>> logs.logout
logout([[nan, nan, nan],
        [7.0, nan, nan],
        [8.0, 1.0, nan],
        [9.0, 3.0, 4.0]])
class hydpy.models.arma.arma_model.Calc_QOut_V1[source]

Bases: Method

Sum up the results of the different response functions.

Requires the derived parameter:

Nmb

Requires the flux sequence:

QPOut

Calculates the flux sequence:

QOut

Examples:

Initialize an arma model with three different response functions:

>>> from hydpy.models.arma import *
>>> parameterstep()
>>> derived.nmb(3)
>>> fluxes.qpout.shape = 3

Define the output values of the three response functions and apply method Calc_QOut_V1:

>>> fluxes.qpout = 1.0, 2.0, 3.0
>>> model.calc_qout_v1()
>>> fluxes.qout
qout(6.0)
class hydpy.models.arma.arma_model.Pick_Q_V1[source]

Bases: Method

Update inflow.

Requires the inlet sequence:

Q

Calculates the flux sequence:

QIn

class hydpy.models.arma.arma_model.Pass_Q_V1[source]

Bases: Method

Update outflow.

Requires the flux sequence:

QOut

Calculates the outlet sequence:

Q

Parameter Features

Control parameters

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

Bases: SubParameters

Control parameters of model arma.

The following classes are selected:
  • Responses() Assigns different ARMA models to different discharge thresholds.

class hydpy.models.arma.arma_control.Responses(subvars: SubParameters)[source]

Bases: Parameter

Assigns different ARMA models to different discharge thresholds.

Parameter Responses is not involved in the actual calculations during the simulation run. Instead, it is thought for the intuitive handling of different ARMA models. It can be applied as follows.

Initially, each new responses object is emtpy:

>>> from hydpy.models.arma import *
>>> parameterstep()
>>> responses
responses()

One can assign ARMA models as attributes to it:

>>> responses.th_0_0 = ((1.0, 2.0), (3.0, 4.0, 6.0))

th_0_0 stands for a threshold discharge value of 0.0 m³/s, which the given ARMA model corresponds to. For integer discharge values, one can omit the decimal digit:

>>> responses.th_1 = ((), (7.0,))

One can also omit the leading letters, but not the underscore:

>>> responses.th_2_5 = ([8.0], range(9, 20))

Internally, all threshold keys are brought into the standard format:

>>> responses
responses(th_0_0=((1.0, 2.0),
                  (3.0, 4.0, 6.0)),
          th_1_0=((),
                  (7.0,)),
          th_2_5=((8.0,),
                  (9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0,
                   18.0, 19.0)))

All ARMA models are available via attribute access and their attribute names are made available to function dir():

>>> "th_1_0" in dir(responses)
True

Note that all iterables containing the AR and MA coefficients are converted to tuples, to prevent them from being changed by accident:

>>> responses.th_1[1][0]
7.0
>>> responses.th_1_0[1][0] = 77.0
Traceback (most recent call last):
...
TypeError: 'tuple' object does not support item assignment

Instead, one can delete and or overwrite existing ARMA models:

>>> del responses.th_2_5
>>> responses.th_1 = ((), (77.0,))
>>> responses
responses(th_0_0=((1.0, 2.0),
                  (3.0, 4.0, 6.0)),
          th_1_0=((),
                  (77.0,)))

Names that cannot be identified as threshold values result in an exception:

>>> responses.test = ((), ())
Traceback (most recent call last):
...
AttributeError: To define different response functions for parameter `responses` of element `?`, one has to pass them as keyword arguments or set them as additional attributes.  The used name must meet a specific format (see the documentation for further information).  The given name `test` does not meet this format.

Suitable get-related attribute exceptions are also implemented:

>>> responses.test
Traceback (most recent call last):
...
AttributeError: Parameter `responses` of element `?` does not have an attribute named `test` and the name `test` is also not a valid threshold value identifier.
>>> responses._0_1
Traceback (most recent call last):
...
AttributeError: Parameter `responses` of element `?` does not have an attribute named `_0_1` nor an arma model corresponding to a threshold value named `th_0_1`.

The above examples show that all AR and MA coefficients are converted to floating point values. It this is not possible or something else goes totally wrong during the definition of a new ARMA model, errors like the following are raised:

>>> responses.th_10 = ()
Traceback (most recent call last):
...
IndexError: While trying to set a new threshold (th_10) coefficient pair for parameter `responses` of element `?`, the following error occurred: tuple index out of range

Except for the mentioned conversion to floating point values, there are no plausibility checks performed. You have to use other tools to gain plausible coefficients. The HydPy framework offers the module iuhtools for such purposes.

Prepare one instantaneous unit hydrograph (iuh) based on the Translation Diffusion Equation and another one based on the Linear Storage Cascade:

>>> from hydpy.auxs.iuhtools import TranslationDiffusionEquation
>>> tde = TranslationDiffusionEquation(d=5.0, u=2.0, x=4.0)
>>> from hydpy.auxs.iuhtools import LinearStorageCascade
>>> lsc = LinearStorageCascade(n=2.5, k=1.0)

The following line deletes the coefficients defined above and assigns the ARMA approximations of both iuh models:

>>> responses(lsc, _2=tde)

One can change the parameter values of the translation diffusion iuh and assign it to the responses parameter, without affecting the ARMA coefficients of the first tde parametrization:

>>> tde.u = 1.0
>>> responses._5 = tde
>>> responses
responses(th_0_0=((1.001744, -0.32693, 0.034286),
                  (0.050456, 0.199156, 0.04631, -0.004812, -0.00021)),
          th_2_0=((2.028483, -1.447371, 0.420257, -0.039595, -0.000275),
                  (0.165732, 0.061819, -0.377523, 0.215754, -0.024597,
                   -0.002684)),
          th_5_0=((3.032315, -3.506645, 1.908546, -0.479333, 0.042839,
                   0.00009),
                  (0.119252, -0.054959, -0.342744, 0.433585, -0.169102,
                   0.014189, 0.001967)))

One may have noted the Linear Storage Cascade model was passed as a positional argument and was assigned to a treshold value of 0.0 m³/s automatically, which is the default value. As each treshold value has to be unique, one can pass only one positional argument:

>>> responses(tde, lsc)
Traceback (most recent call last):
...
ValueError: For parameter `responses` of element `?` at most one positional argument is allowed, but `2` are given.

Checks for the repeated definition of the same threshold values are also performed:

>>> responses(tde, _0=lsc, _1=tde, _1_0=lsc)
Traceback (most recent call last):
...
ValueError: For parameter `responses` of element `?` `4` arguments have been given but only `2` response functions could be prepared.  Most probably, you defined the same threshold value(s) twice.

The number of response functions and the number of the respective AR and MA coefficients of a given responses parameter can be easily queried:

>>> responses(_0=((1.0, 2.0),
...               (3.0, 4.0, 6.0)),
...           _1=((),
...               (7.0,)))
>>> len(responses)
2
>>> responses.ar_orders
(2, 0)
>>> responses.ma_orders
(3, 1)

The threshold values and AR coefficients and the MA coefficients can all be queried as numpy arrays:

>>> from hydpy import print_matrix, print_vector
>>> print_vector(responses.thresholds)
0.0, 1.0
>>> print_matrix(responses.ar_coefs)
| 1.0, 2.0 |
| nan, nan |
>>> print_matrix(responses.ma_coefs)
| 3.0, 4.0, 6.0 |
| 7.0, nan, nan |

Technical notes:

The implementation of this class is much to tricky for subpackage models. It should be generalized and moved to the framework core later.

Furthermore, it would be nice to avoid the nan values in the coefficent representations. But this would possibly require to define a specialized arrays in list type in Cython.

NDIM: int = 0
TYPE

alias of float

TIME: bool | None = None
SPAN: tuple[int | float | bool | None, int | float | bool | None] = (None, None)
property thresholds: ndarray[Any, dtype[float64]]

Threshold values of the response functions.

property ar_orders: tuple[int, ...]

Number of AR coefficients of the different response functions.

property ma_orders: tuple[int, ...]

Number of MA coefficients of the different response functions.

property ar_coefs: ndarray[Any, dtype[float64]]

AR coefficients of the different response functions.

The first row contains the AR coefficients related to the the smallest threshold value, the last row contains the AR coefficients related to the highest threshold value. The number of columns depend on the highest number of AR coefficients among all response functions.

property ma_coefs: ndarray[Any, dtype[float64]]

AR coefficients of the different response functions.

The first row contains the MA coefficients related to the the smallest threshold value, the last row contains the AR coefficients related to the highest threshold value. The number of columns depend on the highest number of MA coefficients among all response functions.

name: str = 'responses'

Name of the variable in lowercase letters.

unit: str = '?'

Unit of the variable.

Derived parameters

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

Bases: SubParameters

Derived parameters of model arma.

The following classes are selected:
  • Nmb() Number of response functions [-].

  • MaxQ() Maximum discharge values of the respective ARMA models [m³/s].

  • DiffQ() Differences between the values of MaxQ [m³/s].

  • AR_Order() Number of AR coefficients of the different responses [-].

  • MA_Order() Number of MA coefficients of the different responses [-].

  • AR_Coefs() AR coefficients of the different responses [-].

  • MA_Coefs() MA coefficients of the different responses [-].

class hydpy.models.arma.arma_derived.Nmb(subvars: SubParameters)[source]

Bases: Parameter

Number of response functions [-].

Required by the methods:

Calc_QAR_V1 Calc_QMA_V1 Calc_QOut_V1 Calc_QPIn_V1 Calc_QPOut_V1 Update_LogIn_V1 Update_LogOut_V1

NDIM: int = 0
TYPE

alias of int

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

Determine the number of response functions.

>>> from hydpy.models.arma import *
>>> parameterstep("1d")
>>> responses(((1., 2.), (1.,)), th_3=((1.,), (1., 2., 3.)))
>>> derived.nmb.update()
>>> derived.nmb
nmb(2)

Note that updating parameter nmb sets the shape of the flux sequences QPIn, QPOut, QMA, and QAR automatically.

>>> fluxes.qpin
qpin(nan, nan)
>>> fluxes.qpout
qpout(nan, nan)
>>> fluxes.qma
qma(nan, nan)
>>> fluxes.qar
qar(nan, nan)
name: str = 'nmb'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.arma.arma_derived.MaxQ(subvars: SubParameters)[source]

Bases: Parameter

Maximum discharge values of the respective ARMA models [m³/s].

Required by the method:

Calc_QPIn_V1

NDIM: int = 1
TYPE

alias of float

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

Determine the maximum discharge values.

>>> from hydpy.models.arma import *
>>> parameterstep("1d")
>>> responses(((1., 2.), (1.,)), th_3=((1.,), (1., 2., 3.)))
>>> derived.maxq.update()
>>> derived.maxq
maxq(0.0, 3.0)
name: str = 'maxq'

Name of the variable in lowercase letters.

unit: str = 'm³/s'

Unit of the variable.

class hydpy.models.arma.arma_derived.DiffQ(subvars: SubParameters)[source]

Bases: Parameter

Differences between the values of MaxQ [m³/s].

Required by the method:

Calc_QPIn_V1

NDIM: int = 1
TYPE

alias of float

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

Determine the “max Q deltas”.

>>> from hydpy.models.arma import *
>>> parameterstep("1d")
>>> responses(((1., 2.), (1.,)), th_3=((1.,), (1., 2., 3.)))
>>> derived.diffq.update()
>>> derived.diffq
diffq(3.0)
 >>> responses(((1., 2.), (1.,)))
>>> derived.diffq.update()
>>> derived.diffq
diffq([])
name: str = 'diffq'

Name of the variable in lowercase letters.

unit: str = 'm³/s'

Unit of the variable.

class hydpy.models.arma.arma_derived.AR_Order(subvars: SubParameters)[source]

Bases: Parameter

Number of AR coefficients of the different responses [-].

Required by the methods:

Calc_QAR_V1 Update_LogOut_V1

NDIM: int = 1
TYPE

alias of int

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

Determine the total number of AR coefficients.

>>> from hydpy.models.arma import *
>>> parameterstep("1d")
>>> responses(((1., 2.), (1.,)), th_3=((1.,), (1., 2., 3.)))
>>> derived.ar_order.update()
>>> derived.ar_order
ar_order(2, 1)
name: str = 'ar_order'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.arma.arma_derived.MA_Order(subvars: SubParameters)[source]

Bases: Parameter

Number of MA coefficients of the different responses [-].

Required by the methods:

Calc_QMA_V1 Update_LogIn_V1

NDIM: int = 1
TYPE

alias of int

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

Determine the total number of MA coefficients.

>>> from hydpy.models.arma import *
>>> parameterstep("1d")
>>> responses(((1., 2.), (1.,)), th_3=((1.,), (1., 2., 3.)))
>>> derived.ma_order.update()
>>> derived.ma_order
ma_order(1, 3)
name: str = 'ma_order'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.arma.arma_derived.AR_Coefs(subvars: SubParameters)[source]

Bases: Parameter

AR coefficients of the different responses [-].

Required by the method:

Calc_QAR_V1

NDIM: int = 2
TYPE

alias of float

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

Determine all AR coefficients.

>>> from hydpy.models.arma import *
>>> parameterstep("1d")
>>> responses(((1., 2.), (1.,)), th_3=((1.,), (1., 2., 3.)))
>>> derived.ar_coefs.update()
>>> derived.ar_coefs
ar_coefs([[1.0, 2.0],
          [1.0, nan]])

Note that updating parameter ar_coefs sets the shape of the log sequence LogOut automatically.

>>> logs.logout
logout([[nan, nan],
        [nan, nan]])
name: str = 'ar_coefs'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

class hydpy.models.arma.arma_derived.MA_Coefs(subvars: SubParameters)[source]

Bases: Parameter

MA coefficients of the different responses [-].

Required by the method:

Calc_QMA_V1

NDIM: int = 2
TYPE

alias of float

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

Determine all MA coefficients.

>>> from hydpy.models.arma import *
>>> parameterstep("1d")
>>> responses(((1., 2.), (1.,)), th_3=((1.,), (1., 2., 3.)))
>>> derived.ma_coefs.update()
>>> derived.ma_coefs
ma_coefs([[1.0, nan, nan],
          [1.0, 2.0, 3.0]])

Note that updating parameter ar_coefs sets the shape of the log sequence LogIn automatically.

>>> logs.login
login([[nan, nan, nan],
       [nan, nan, nan]])
name: str = 'ma_coefs'

Name of the variable in lowercase letters.

unit: str = '-'

Unit of the variable.

Sequence Features

Flux sequences

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

Bases: FluxSequences

Flux sequences of model arma.

The following classes are selected:
  • QIn() Total inflow [m³/s].

  • QPIn() Inflow portions corresponding to the different thresholds [m³/s].

  • QMA() MA result for the different thresholds [m³/s].

  • QAR() AR result for the different thresholds [m³/s].

  • QPOut() Outflow portions corresponding to the different thresholds [m³/s].

  • QOut() Total outflow [m³/s].

class hydpy.models.arma.arma_fluxes.QIn(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FluxSequence

Total inflow [m³/s].

Calculated by the method:

Pick_Q_V1

Required by the method:

Calc_QPIn_V1

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

Name of the variable in lowercase letters.

unit: str = 'm³/s'

Unit of the variable.

class hydpy.models.arma.arma_fluxes.QPIn(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FluxSequence

Inflow portions corresponding to the different thresholds [m³/s].

Calculated by the method:

Calc_QPIn_V1

Required by the method:

Update_LogIn_V1

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

Name of the variable in lowercase letters.

unit: str = 'm³/s'

Unit of the variable.

class hydpy.models.arma.arma_fluxes.QMA(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FluxSequence

MA result for the different thresholds [m³/s].

Calculated by the method:

Calc_QMA_V1

Required by the method:

Calc_QPOut_V1

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

Name of the variable in lowercase letters.

unit: str = 'm³/s'

Unit of the variable.

class hydpy.models.arma.arma_fluxes.QAR(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FluxSequence

AR result for the different thresholds [m³/s].

Calculated by the method:

Calc_QAR_V1

Required by the method:

Calc_QPOut_V1

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

Name of the variable in lowercase letters.

unit: str = 'm³/s'

Unit of the variable.

class hydpy.models.arma.arma_fluxes.QPOut(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FluxSequence

Outflow portions corresponding to the different thresholds [m³/s].

Calculated by the method:

Calc_QPOut_V1

Required by the methods:

Calc_QOut_V1 Update_LogOut_V1

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

Name of the variable in lowercase letters.

unit: str = 'm³/s'

Unit of the variable.

class hydpy.models.arma.arma_fluxes.QOut(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: FluxSequence

Total outflow [m³/s].

Calculated by the method:

Calc_QOut_V1

Required by the method:

Pass_Q_V1

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

Name of the variable in lowercase letters.

unit: str = 'm³/s'

Unit of the variable.

Log sequences

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

Bases: LogSequences

Log sequences of model arma.

The following classes are selected:
  • LogIn() The recent and the past inflow portions for the application of the different MA processes [m³/s].

  • LogOut() The past outflow portions for the application of the different AR processes [m³/s].

class hydpy.models.arma.arma_logs.LogIn(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: LogSequence

The recent and the past inflow portions for the application of the different MA processes [m³/s].

Updated by the method:

Update_LogIn_V1

Required by the method:

Calc_QMA_V1

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

Name of the variable in lowercase letters.

unit: str = 'm³/s'

Unit of the variable.

class hydpy.models.arma.arma_logs.LogOut(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: LogSequence

The past outflow portions for the application of the different AR processes [m³/s].

Updated by the method:

Update_LogOut_V1

Required by the method:

Calc_QAR_V1

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

Name of the variable in lowercase letters.

unit: str = 'm³/s'

Unit of the variable.

Inlet sequences

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

Bases: InletSequences

Inlet sequences of model arma.

The following classes are selected:
  • Q() Runoff [m³/s].

class hydpy.models.arma.arma_inlets.Q(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: InletSequence

Runoff [m³/s].

Required by the method:

Pick_Q_V1

NDIM: int = 1
NUMERIC: bool = False
name: str = 'q'

Name of the variable in lowercase letters.

unit: str = 'm³/s'

Unit of the variable.

Outlet sequences

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

Bases: OutletSequences

Outlet sequences of model arma.

The following classes are selected:
  • Q() Runoff [m³/s].

class hydpy.models.arma.arma_outlets.Q(subvars: ModelSequences[ModelSequence, FastAccess])[source]

Bases: OutletSequence

Runoff [m³/s].

Calculated by the method:

Pass_Q_V1

NDIM: int = 0
NUMERIC: bool = False
name: str = 'q'

Name of the variable in lowercase letters.

unit: str = 'm³/s'

Unit of the variable.

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

Bases: SubParameters

Control parameters of model arma.

The following classes are selected:
  • Responses() Assigns different ARMA models to different discharge thresholds.

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

Bases: SubParameters

Derived parameters of model arma.

The following classes are selected:
  • Nmb() Number of response functions [-].

  • MaxQ() Maximum discharge values of the respective ARMA models [m³/s].

  • DiffQ() Differences between the values of MaxQ [m³/s].

  • AR_Order() Number of AR coefficients of the different responses [-].

  • MA_Order() Number of MA coefficients of the different responses [-].

  • AR_Coefs() AR coefficients of the different responses [-].

  • MA_Coefs() MA coefficients of the different responses [-].

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

Bases: FluxSequences

Flux sequences of model arma.

The following classes are selected:
  • QIn() Total inflow [m³/s].

  • QPIn() Inflow portions corresponding to the different thresholds [m³/s].

  • QMA() MA result for the different thresholds [m³/s].

  • QAR() AR result for the different thresholds [m³/s].

  • QPOut() Outflow portions corresponding to the different thresholds [m³/s].

  • QOut() Total outflow [m³/s].

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

Bases: InletSequences

Inlet sequences of model arma.

The following classes are selected:
  • Q() Runoff [m³/s].

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

Bases: LogSequences

Log sequences of model arma.

The following classes are selected:
  • LogIn() The recent and the past inflow portions for the application of the different MA processes [m³/s].

  • LogOut() The past outflow portions for the application of the different AR processes [m³/s].

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

Bases: OutletSequences

Outlet sequences of model arma.

The following classes are selected:
  • Q() Runoff [m³/s].