test¶
The base model test is intended for implementing small application model
that allow for testing or demonstrating specific features of the HydPy
framework.
Method Features¶
-
class
hydpy.models.test.test_model.Model[source]¶ Bases:
hydpy.core.modeltools.ELSModelTest model.
- The following methods define the relevant components of a system of ODE equations (e.g. direct runoff):
Calc_Q_V1Calculate the actual storage loss.Calc_Q_V2Calculate the actual storage loss.Calc_QV_V1Calculate the actual storage losses.
- The following methods define the complete equations of an ODE system (e.g. change in storage of fast water due to effective precipitation and direct runoff):
Calc_S_V1Calculate the actual storage content.Calc_SV_V1Calculate the actual storage contenst.
-
numconsts: hydpy.core.modeltools.NumConstsELS¶
-
numvars: hydpy.core.modeltools.NumVarsELS¶
-
element: Optional[‘devicetools.Element’]¶
-
cymodel: Optional[typingtools.CyModelProtocol]¶
-
parameters: parametertools.Parameters¶
-
sequences: sequencetools.Sequences¶
-
masks: masktools.Masks¶
-
class
hydpy.models.test.test_model.Calc_Q_V1[source]¶ Bases:
hydpy.core.modeltools.MethodCalculate the actual storage loss.
This simple equation is continuous but potentially stiff.
- Basic equation:
\(Q = K \cdot S\)
Example:
>>> from hydpy.models.test import * >>> parameterstep() >>> k(0.5) >>> states.s = 2.0 >>> model.calc_q_v1() >>> fluxes.q q(1.0)
-
class
hydpy.models.test.test_model.Calc_Q_V2[source]¶ Bases:
hydpy.core.modeltools.MethodCalculate the actual storage loss.
This simple equation is discontinuous.
- Basic equation:
\(Q = \Bigl \lbrace { {K \ | \ S > 0} \atop {0 \ | \ S \leq 0} }\)
Examples:
>>> from hydpy.models.test import * >>> parameterstep() >>> k(0.5) >>> states.s = 2.0 >>> model.calc_q_v2() >>> fluxes.q q(0.5) >>> states.s = -1.0 >>> model.calc_q_v2() >>> fluxes.q q(0.0)
-
class
hydpy.models.test.test_model.Calc_QV_V1[source]¶ Bases:
hydpy.core.modeltools.MethodCalculate the actual storage losses.
Identical with
Calc_Q_V1, but working on a vector of states.- Basic equation:
\(Q = K \cdot S\)
Example:
>>> from hydpy.models.test import * >>> parameterstep() >>> n(2) >>> k(0.5) >>> states.sv = 2.0, 3.0 >>> model.calc_qv_v1() >>> fluxes.qv qv(1.0, 1.5)
-
class
hydpy.models.test.test_model.Calc_S_V1[source]¶ Bases:
hydpy.core.modeltools.MethodCalculate the actual storage content.
Example:
>>> from hydpy.models.test import * >>> parameterstep() >>> states.s.old = 1.0 >>> fluxes.q = 0.8 >>> model.calc_s_v1() >>> states.s s(0.2)
-
class
hydpy.models.test.test_model.Calc_SV_V1[source]¶ Bases:
hydpy.core.modeltools.MethodCalculate the actual storage contenst.
Identical with
Calc_S_V1, but working on a vector of fluxes.- Basic equation:
\(\frac{dS}{dt} = Q\)
Example:
>>> from hydpy.models.test import * >>> parameterstep() >>> n(2) >>> states.sv.old = 1.0, 2.0 >>> fluxes.qv = 0.8 >>> model.calc_sv_v1() >>> states.sv sv(0.2, 1.2)
Parameter Features¶
Control parameters¶
-
class
hydpy.models.test.ControlParameters(master: hydpy.core.parametertools.Parameters, cls_fastaccess: Optional[Type[hydpy.core.parametertools.FastAccessParameter]] = None, cymodel: Optional[hydpy.core.typingtools.CyModelProtocol] = None) Bases:
hydpy.core.variabletools.SubVariables[hydpy.core.parametertools.Parameters,Parameter,hydpy.core.parametertools.FastAccessParameter]Control parameters of model test.
-
class
hydpy.models.test.test_control.K(subvars: SubVariablesType)[source]¶ Bases:
hydpy.core.variabletools.Variable[hydpy.core.parametertools.SubParameters,hydpy.core.parametertools.FastAccessParameter]Storage coefficient [1/T].
- Required by the methods:
For educational purposes, the actual value of parameter
Kdoes not depend on the difference between the actual simulation time step and the actual parameter time step.-
TYPE¶
-
subvars: SubVariablesType¶
-
class
hydpy.models.test.test_control.N(subvars: SubVariablesType)[source]¶ Bases:
hydpy.core.variabletools.Variable[hydpy.core.parametertools.SubParameters,hydpy.core.parametertools.FastAccessParameter]Number of storages [-].
- Required by the methods:
-
TYPE¶
-
subvars: SubVariablesType¶
Solver parameters¶
-
class
hydpy.models.test.SolverParameters(master: hydpy.core.parametertools.Parameters, cls_fastaccess: Optional[Type[hydpy.core.parametertools.FastAccessParameter]] = None, cymodel: Optional[hydpy.core.typingtools.CyModelProtocol] = None) Bases:
hydpy.core.variabletools.SubVariables[hydpy.core.parametertools.Parameters,Parameter,hydpy.core.parametertools.FastAccessParameter]Solver parameters of model test.
- The following classes are selected:
AbsErrorMax()Absolute numerical error tolerance [mm/T].RelErrorMax()Relative numerical error tolerance [1/T].RelDTMin()Smallest relative integration time step size allowed [-].RelDTMax()Largest relative integration time step size allowed [-].
-
class
hydpy.models.test.test_solver.AbsErrorMax(subvars)[source]¶ Bases:
hydpy.core.variabletools.Variable[hydpy.core.parametertools.SubParameters,hydpy.core.parametertools.FastAccessParameter]Absolute numerical error tolerance [mm/T].
-
TYPE¶
-
-
subvars: SubVariablesType¶
-
class
hydpy.models.test.test_solver.RelErrorMax(subvars)[source]¶ Bases:
hydpy.core.variabletools.Variable[hydpy.core.parametertools.SubParameters,hydpy.core.parametertools.FastAccessParameter]Relative numerical error tolerance [1/T].
-
TYPE¶
-
-
subvars: SubVariablesType¶
-
class
hydpy.models.test.test_solver.RelDTMin(subvars)[source]¶ Bases:
hydpy.core.variabletools.Variable[hydpy.core.parametertools.SubParameters,hydpy.core.parametertools.FastAccessParameter]Smallest relative integration time step size allowed [-].
-
TYPE¶
-
-
subvars: SubVariablesType¶
-
class
hydpy.models.test.test_solver.RelDTMax(subvars)[source]¶ Bases:
hydpy.core.variabletools.Variable[hydpy.core.parametertools.SubParameters,hydpy.core.parametertools.FastAccessParameter]Largest relative integration time step size allowed [-].
-
TYPE¶
-
-
subvars: SubVariablesType¶
Sequence Features¶
Flux sequences¶
-
class
hydpy.models.test.FluxSequences(master: hydpy.core.sequencetools.Sequences, cls_fastaccess: Optional[Type[FastAccessType]] = None, cymodel: Optional[hydpy.core.typingtools.CyModelProtocol] = None) Bases:
hydpy.core.sequencetools.OutputSequences[FluxSequence]Flux sequences of model test.
-
vars: GroupType
-
-
class
hydpy.models.test.test_fluxes.Q(subvars: SubVariablesType)[source]¶ Bases:
hydpy.core.sequencetools.OutputSequence[hydpy.core.sequencetools.FluxSequences]Storage loss [mm/T]
-
subvars: SubVariablesType¶
-
-
class
hydpy.models.test.test_fluxes.QV(subvars: SubVariablesType)[source]¶ Bases:
hydpy.core.sequencetools.OutputSequence[hydpy.core.sequencetools.FluxSequences]Storage loss vector [mm/T]
- Calculated by the method:
- Required by the method:
-
subvars: SubVariablesType¶
State sequences¶
-
class
hydpy.models.test.StateSequences(master: hydpy.core.sequencetools.Sequences, cls_fastaccess: Optional[Type[FastAccessType]] = None, cymodel: Optional[hydpy.core.typingtools.CyModelProtocol] = None) Bases:
hydpy.core.sequencetools.OutputSequences[StateSequence]State sequences of model test.
-
class
hydpy.models.test.test_states.S(subvars: SubVariablesType)[source]¶ Bases:
hydpy.core.sequencetools.OutputSequence[hydpy.core.sequencetools.StateSequences],hydpy.core.sequencetools.ConditionSequence[hydpy.core.sequencetools.StateSequences,hydpy.core.sequencetools.FastAccessOutputSequence]Storage content [mm].
-
subvars: SubVariablesType¶
-
-
class
hydpy.models.test.test_states.SV(subvars: SubVariablesType)[source]¶ Bases:
hydpy.core.sequencetools.OutputSequence[hydpy.core.sequencetools.StateSequences],hydpy.core.sequencetools.ConditionSequence[hydpy.core.sequencetools.StateSequences,hydpy.core.sequencetools.FastAccessOutputSequence]Storage content vector[mm].
- Updated by the method:
- Required by the method:
-
subvars: SubVariablesType¶
-
class
hydpy.models.test.ControlParameters(master: hydpy.core.parametertools.Parameters, cls_fastaccess: Optional[Type[hydpy.core.parametertools.FastAccessParameter]] = None, cymodel: Optional[hydpy.core.typingtools.CyModelProtocol] = None)¶ Bases:
hydpy.core.variabletools.SubVariables[hydpy.core.parametertools.Parameters,Parameter,hydpy.core.parametertools.FastAccessParameter]Control parameters of model test.
-
class
hydpy.models.test.FluxSequences(master: hydpy.core.sequencetools.Sequences, cls_fastaccess: Optional[Type[FastAccessType]] = None, cymodel: Optional[hydpy.core.typingtools.CyModelProtocol] = None)¶ Bases:
hydpy.core.sequencetools.OutputSequences[FluxSequence]Flux sequences of model test.
-
vars: GroupType¶
-
-
class
hydpy.models.test.SolverParameters(master: hydpy.core.parametertools.Parameters, cls_fastaccess: Optional[Type[hydpy.core.parametertools.FastAccessParameter]] = None, cymodel: Optional[hydpy.core.typingtools.CyModelProtocol] = None)¶ Bases:
hydpy.core.variabletools.SubVariables[hydpy.core.parametertools.Parameters,Parameter,hydpy.core.parametertools.FastAccessParameter]Solver parameters of model test.
- The following classes are selected:
AbsErrorMax()Absolute numerical error tolerance [mm/T].RelErrorMax()Relative numerical error tolerance [1/T].RelDTMin()Smallest relative integration time step size allowed [-].RelDTMax()Largest relative integration time step size allowed [-].
-
class
hydpy.models.test.StateSequences(master: hydpy.core.sequencetools.Sequences, cls_fastaccess: Optional[Type[FastAccessType]] = None, cymodel: Optional[hydpy.core.typingtools.CyModelProtocol] = None)¶ Bases:
hydpy.core.sequencetools.OutputSequences[StateSequence]State sequences of model test.