sentence1 stringlengths 52 3.87M | sentence2 stringlengths 1 47.2k | label stringclasses 1
value |
|---|---|---|
def assignrepr(self, prefix: str) -> str:
"""Return a |repr| string with a prefixed assignment."""
with objecttools.repr_.preserve_strings(True):
with objecttools.assignrepr_tuple.always_bracketed(False):
blanks = ' ' * (len(prefix) + 8)
lines = ['%sElement("%... | Return a |repr| string with a prefixed assignment. | entailment |
def _init_methods(self):
"""Convert all pure Python calculation functions of the model class to
methods and assign them to the model instance.
"""
for name_group in self._METHOD_GROUPS:
functions = getattr(self, name_group, ())
uniques = {}
for func in... | Convert all pure Python calculation functions of the model class to
methods and assign them to the model instance. | entailment |
def name(self):
"""Name of the model type.
For base models, |Model.name| corresponds to the package name:
>>> from hydpy import prepare_model
>>> hland = prepare_model('hland')
>>> hland.name
'hland'
For application models, |Model.name| corresponds the module n... | Name of the model type.
For base models, |Model.name| corresponds to the package name:
>>> from hydpy import prepare_model
>>> hland = prepare_model('hland')
>>> hland.name
'hland'
For application models, |Model.name| corresponds the module name:
>>> hland_v1 ... | entailment |
def connect(self):
"""Connect the link sequences of the actual model."""
try:
for group in ('inlets', 'receivers', 'outlets', 'senders'):
self._connect_subgroup(group)
except BaseException:
objecttools.augment_excmessage(
'While trying to b... | Connect the link sequences of the actual model. | entailment |
def calculate_single_terms(self):
"""Apply all methods stored in the hidden attribute
`PART_ODE_METHODS`.
>>> from hydpy.models.test_v1 import *
>>> parameterstep()
>>> k(0.25)
>>> states.s = 1.0
>>> model.calculate_single_terms()
>>> fluxes.q
q(0... | Apply all methods stored in the hidden attribute
`PART_ODE_METHODS`.
>>> from hydpy.models.test_v1 import *
>>> parameterstep()
>>> k(0.25)
>>> states.s = 1.0
>>> model.calculate_single_terms()
>>> fluxes.q
q(0.25) | entailment |
def get_sum_fluxes(self):
"""Get the sum of the fluxes calculated so far.
>>> from hydpy.models.test_v1 import *
>>> parameterstep()
>>> fluxes.q = 0.0
>>> fluxes.fastaccess._q_sum = 1.0
>>> model.get_sum_fluxes()
>>> fluxes.q
q(1.0)
"""
f... | Get the sum of the fluxes calculated so far.
>>> from hydpy.models.test_v1 import *
>>> parameterstep()
>>> fluxes.q = 0.0
>>> fluxes.fastaccess._q_sum = 1.0
>>> model.get_sum_fluxes()
>>> fluxes.q
q(1.0) | entailment |
def integrate_fluxes(self):
"""Perform a dot multiplication between the fluxes and the
A coefficients associated with the different stages of the
actual method.
>>> from hydpy.models.test_v1 import *
>>> parameterstep()
>>> model.numvars.idx_method = 2
>>> model.... | Perform a dot multiplication between the fluxes and the
A coefficients associated with the different stages of the
actual method.
>>> from hydpy.models.test_v1 import *
>>> parameterstep()
>>> model.numvars.idx_method = 2
>>> model.numvars.idx_stage = 1
>>> model... | entailment |
def reset_sum_fluxes(self):
"""Set the sum of the fluxes calculated so far to zero.
>>> from hydpy.models.test_v1 import *
>>> parameterstep()
>>> fluxes.fastaccess._q_sum = 5.
>>> model.reset_sum_fluxes()
>>> fluxes.fastaccess._q_sum
0.0
"""
flux... | Set the sum of the fluxes calculated so far to zero.
>>> from hydpy.models.test_v1 import *
>>> parameterstep()
>>> fluxes.fastaccess._q_sum = 5.
>>> model.reset_sum_fluxes()
>>> fluxes.fastaccess._q_sum
0.0 | entailment |
def addup_fluxes(self):
"""Add up the sum of the fluxes calculated so far.
>>> from hydpy.models.test_v1 import *
>>> parameterstep()
>>> fluxes.fastaccess._q_sum = 1.0
>>> fluxes.q(2.0)
>>> model.addup_fluxes()
>>> fluxes.fastaccess._q_sum
3.0
""... | Add up the sum of the fluxes calculated so far.
>>> from hydpy.models.test_v1 import *
>>> parameterstep()
>>> fluxes.fastaccess._q_sum = 1.0
>>> fluxes.q(2.0)
>>> model.addup_fluxes()
>>> fluxes.fastaccess._q_sum
3.0 | entailment |
def calculate_error(self):
"""Estimate the numerical error based on the fluxes calculated
by the current and the last method.
>>> from hydpy.models.test_v1 import *
>>> parameterstep()
>>> model.numvars.idx_method = 2
>>> results = numpy.asarray(fluxes.fastaccess._q_resu... | Estimate the numerical error based on the fluxes calculated
by the current and the last method.
>>> from hydpy.models.test_v1 import *
>>> parameterstep()
>>> model.numvars.idx_method = 2
>>> results = numpy.asarray(fluxes.fastaccess._q_results)
>>> results[:4] = 0., 3.,... | entailment |
def extrapolate_error(self):
"""Estimate the numerical error to be expected when applying all
methods available based on the results of the current and the
last method.
Note that this expolation strategy cannot be applied on the first
method. If the current method is the first ... | Estimate the numerical error to be expected when applying all
methods available based on the results of the current and the
last method.
Note that this expolation strategy cannot be applied on the first
method. If the current method is the first one, `-999.9` is returned.
>>> ... | entailment |
def run_simulation(projectname: str, xmlfile: str):
"""Perform a HydPy workflow in agreement with the given XML configuration
file available in the directory of the given project. ToDo
Function |run_simulation| is a "script function" and is normally used as
explained in the main documentation on module... | Perform a HydPy workflow in agreement with the given XML configuration
file available in the directory of the given project. ToDo
Function |run_simulation| is a "script function" and is normally used as
explained in the main documentation on module |xmltools|. | entailment |
def validate_xml(self) -> None:
"""Raise an error if the actual XML does not agree with one of the
available schema files.
# ToDo: should it be accompanied by a script function?
The first example relies on a distorted version of the configuration
file `single_run.xml`:
... | Raise an error if the actual XML does not agree with one of the
available schema files.
# ToDo: should it be accompanied by a script function?
The first example relies on a distorted version of the configuration
file `single_run.xml`:
>>> from hydpy.core.examples import prepar... | entailment |
def update_options(self) -> None:
"""Update the |Options| object available in module |pub| with the
values defined in the `options` XML element.
>>> from hydpy.auxs.xmltools import XMLInterface
>>> from hydpy import data, pub
>>> interface = XMLInterface('single_run.xml', data.g... | Update the |Options| object available in module |pub| with the
values defined in the `options` XML element.
>>> from hydpy.auxs.xmltools import XMLInterface
>>> from hydpy import data, pub
>>> interface = XMLInterface('single_run.xml', data.get_path('LahnH'))
>>> pub.options.pri... | entailment |
def update_timegrids(self) -> None:
"""Update the |Timegrids| object available in module |pub| with the
values defined in the `timegrid` XML element.
Usually, one would prefer to define `firstdate`, `lastdate`, and
`stepsize` elements as in the XML configuration file of the
`Lah... | Update the |Timegrids| object available in module |pub| with the
values defined in the `timegrid` XML element.
Usually, one would prefer to define `firstdate`, `lastdate`, and
`stepsize` elements as in the XML configuration file of the
`LahnH` example project:
>>> from hydpy.co... | entailment |
def elements(self) -> Iterator[devicetools.Element]:
"""Yield all |Element| objects returned by |XMLInterface.selections|
and |XMLInterface.devices| without duplicates.
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> from hydpy import... | Yield all |Element| objects returned by |XMLInterface.selections|
and |XMLInterface.devices| without duplicates.
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> from hydpy import HydPy, TestIO, XMLInterface
>>> hp = HydPy('LahnH')
... | entailment |
def fullselection(self) -> selectiontools.Selection:
"""A |Selection| object containing all |Element| and |Node| objects
defined by |XMLInterface.selections| and |XMLInterface.devices|.
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> ... | A |Selection| object containing all |Element| and |Node| objects
defined by |XMLInterface.selections| and |XMLInterface.devices|.
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> from hydpy import HydPy, TestIO, XMLInterface
>>> hp = H... | entailment |
def load_conditions(self) -> None:
"""Load the condition files of the |Model| objects of all |Element|
objects returned by |XMLInterface.elements|:
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> from hydpy import HydPy, TestIO, XMLIn... | Load the condition files of the |Model| objects of all |Element|
objects returned by |XMLInterface.elements|:
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> from hydpy import HydPy, TestIO, XMLInterface
>>> hp = HydPy('LahnH')
... | entailment |
def save_conditions(self) -> None:
"""Save the condition files of the |Model| objects of all |Element|
objects returned by |XMLInterface.elements|:
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> import os
>>> from hydpy impor... | Save the condition files of the |Model| objects of all |Element|
objects returned by |XMLInterface.elements|:
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> import os
>>> from hydpy import HydPy, TestIO, XMLInterface, pub
>>>... | entailment |
def prepare_series(self) -> None:
# noinspection PyUnresolvedReferences
"""Call |XMLSubseries.prepare_series| of all |XMLSubseries|
objects with the same memory |set| object.
>>> from hydpy.auxs.xmltools import XMLInterface, XMLSubseries
>>> from hydpy import data
>>> in... | Call |XMLSubseries.prepare_series| of all |XMLSubseries|
objects with the same memory |set| object.
>>> from hydpy.auxs.xmltools import XMLInterface, XMLSubseries
>>> from hydpy import data
>>> interface = XMLInterface('single_run.xml', data.get_path('LahnH'))
>>> series_io = in... | entailment |
def selections(self) -> selectiontools.Selections:
"""The |Selections| object defined for the respective `reader`
or `writer` element of the actual XML file. ToDo
If the `reader` or `writer` element does not define a special
selections element, the general |XMLInterface.selections| elem... | The |Selections| object defined for the respective `reader`
or `writer` element of the actual XML file. ToDo
If the `reader` or `writer` element does not define a special
selections element, the general |XMLInterface.selections| element
of |XMLInterface| is used.
>>> from hydpy... | entailment |
def devices(self) -> selectiontools.Selection:
"""The additional devices defined for the respective `reader`
or `writer` element contained within a |Selection| object. ToDo
If the `reader` or `writer` element does not define its own additional
devices, |XMLInterface.devices| of |XMLInte... | The additional devices defined for the respective `reader`
or `writer` element contained within a |Selection| object. ToDo
If the `reader` or `writer` element does not define its own additional
devices, |XMLInterface.devices| of |XMLInterface| is used.
>>> from hydpy.core.examples impo... | entailment |
def prepare_sequencemanager(self) -> None:
"""Configure the |SequenceManager| object available in module
|pub| following the definitions of the actual XML `reader` or
`writer` element when available; if not use those of the XML
`series_io` element.
Compare the following results ... | Configure the |SequenceManager| object available in module
|pub| following the definitions of the actual XML `reader` or
`writer` element when available; if not use those of the XML
`series_io` element.
Compare the following results with `single_run.xml` to see that the
first `w... | entailment |
def model2subs2seqs(self) -> Dict[str, Dict[str, List[str]]]:
"""A nested |collections.defaultdict| containing the model specific
information provided by the XML `sequences` element.
>>> from hydpy.auxs.xmltools import XMLInterface
>>> from hydpy import data
>>> interface = XMLI... | A nested |collections.defaultdict| containing the model specific
information provided by the XML `sequences` element.
>>> from hydpy.auxs.xmltools import XMLInterface
>>> from hydpy import data
>>> interface = XMLInterface('single_run.xml', data.get_path('LahnH'))
>>> series_io ... | entailment |
def subs2seqs(self) -> Dict[str, List[str]]:
"""A |collections.defaultdict| containing the node-specific
information provided by XML `sequences` element.
>>> from hydpy.auxs.xmltools import XMLInterface
>>> from hydpy import data
>>> interface = XMLInterface('single_run.xml', da... | A |collections.defaultdict| containing the node-specific
information provided by XML `sequences` element.
>>> from hydpy.auxs.xmltools import XMLInterface
>>> from hydpy import data
>>> interface = XMLInterface('single_run.xml', data.get_path('LahnH'))
>>> series_io = interface.... | entailment |
def prepare_series(self, memory: set) -> None:
"""Call |IOSequence.activate_ram| of all sequences selected by
the given output element of the actual XML file.
Use the memory argument to pass in already prepared sequences;
newly prepared sequences will be added.
>>> from hydpy.c... | Call |IOSequence.activate_ram| of all sequences selected by
the given output element of the actual XML file.
Use the memory argument to pass in already prepared sequences;
newly prepared sequences will be added.
>>> from hydpy.core.examples import prepare_full_example_1
>>> pre... | entailment |
def load_series(self) -> None:
"""Load time series data as defined by the actual XML `reader`
element.
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> from hydpy import HydPy, TestIO, XMLInterface
>>> hp = HydPy('LahnH')
... | Load time series data as defined by the actual XML `reader`
element.
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> from hydpy import HydPy, TestIO, XMLInterface
>>> hp = HydPy('LahnH')
>>> with TestIO():
... hp.p... | entailment |
def save_series(self) -> None:
"""Save time series data as defined by the actual XML `writer`
element.
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> from hydpy import HydPy, TestIO, XMLInterface
>>> hp = HydPy('LahnH')
... | Save time series data as defined by the actual XML `writer`
element.
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> from hydpy import HydPy, TestIO, XMLInterface
>>> hp = HydPy('LahnH')
>>> with TestIO():
... hp.p... | entailment |
def item(self):
""" ToDo
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> from hydpy import HydPy, TestIO, XMLInterface, pub
>>> hp = HydPy('LahnH')
>>> pub.timegrids = '1996-01-01', '1996-01-06', '1d'
>>> with TestIO()... | ToDo
>>> from hydpy.core.examples import prepare_full_example_1
>>> prepare_full_example_1()
>>> from hydpy import HydPy, TestIO, XMLInterface, pub
>>> hp = HydPy('LahnH')
>>> pub.timegrids = '1996-01-01', '1996-01-06', '1d'
>>> with TestIO():
... hp.prepare... | entailment |
def write_xsd(cls) -> None:
"""Write the complete base schema file `HydPyConfigBase.xsd` based
on the template file `HydPyConfigBase.xsdt`.
Method |XSDWriter.write_xsd| adds model specific information to the
general information of template file `HydPyConfigBase.xsdt` regarding
r... | Write the complete base schema file `HydPyConfigBase.xsd` based
on the template file `HydPyConfigBase.xsdt`.
Method |XSDWriter.write_xsd| adds model specific information to the
general information of template file `HydPyConfigBase.xsdt` regarding
reading and writing of time series data ... | entailment |
def get_modelnames() -> List[str]:
"""Return a sorted |list| containing all application model names.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_modelnames()) # doctest: +ELLIPSIS
[...'dam_v001', 'dam_v002', 'dam_v003', 'dam_v004', 'dam_v005',...]
""... | Return a sorted |list| containing all application model names.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_modelnames()) # doctest: +ELLIPSIS
[...'dam_v001', 'dam_v002', 'dam_v003', 'dam_v004', 'dam_v005',...] | entailment |
def get_insertion(cls) -> str:
"""Return the complete string to be inserted into the string of the
template file.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_insertion()) # doctest: +ELLIPSIS
<element name="arma_v1"
substit... | Return the complete string to be inserted into the string of the
template file.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_insertion()) # doctest: +ELLIPSIS
<element name="arma_v1"
substitutionGroup="hpcb:sequenceGroup"
... | entailment |
def get_modelinsertion(cls, model, indent) -> str:
"""Return the insertion string required for the given application model.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> from hydpy import prepare_model
>>> model = prepare_model('hland_v1')
>>> print(XSDWriter.get_modelinsert... | Return the insertion string required for the given application model.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> from hydpy import prepare_model
>>> model = prepare_model('hland_v1')
>>> print(XSDWriter.get_modelinsertion(model, 1)) # doctest: +ELLIPSIS
<element nam... | entailment |
def get_subsequencesinsertion(cls, subsequences, indent) -> str:
"""Return the insertion string required for the given group of
sequences.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> from hydpy import prepare_model
>>> model = prepare_model('hland_v1')
>>> print(XS... | Return the insertion string required for the given group of
sequences.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> from hydpy import prepare_model
>>> model = prepare_model('hland_v1')
>>> print(XSDWriter.get_subsequencesinsertion(
... model.sequences.fluxes, 1... | entailment |
def get_exchangeinsertion(cls):
"""Return the complete string related to the definition of exchange
items to be inserted into the string of the template file.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_exchangeinsertion()) # doctest: +ELLIPSIS
<... | Return the complete string related to the definition of exchange
items to be inserted into the string of the template file.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_exchangeinsertion()) # doctest: +ELLIPSIS
<complexType name="arma_v1_mathitemType">
... | entailment |
def get_mathitemsinsertion(cls, indent) -> str:
"""Return a string defining a model specific XML type extending
`ItemType`.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_mathitemsinsertion(1)) # doctest: +ELLIPSIS
<complexType name="arma_v1_mathite... | Return a string defining a model specific XML type extending
`ItemType`.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_mathitemsinsertion(1)) # doctest: +ELLIPSIS
<complexType name="arma_v1_mathitemType">
<complexContent>
... | entailment |
def get_itemsinsertion(cls, itemgroup, indent) -> str:
"""Return a string defining the XML element for the given
exchange item group.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_itemsinsertion(
... 'setitems', 1)) # doctest: +ELLIPSIS
... | Return a string defining the XML element for the given
exchange item group.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_itemsinsertion(
... 'setitems', 1)) # doctest: +ELLIPSIS
<element name="setitems">
<complexType>
... | entailment |
def get_itemtypesinsertion(cls, itemgroup, indent) -> str:
"""Return a string defining the required types for the given
exchange item group.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_itemtypesinsertion(
... 'setitems', 1)) # doctest: +ELLIPSIS
... | Return a string defining the required types for the given
exchange item group.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_itemtypesinsertion(
... 'setitems', 1)) # doctest: +ELLIPSIS
<complexType name="arma_v1_setitemsType">
...
... | entailment |
def get_itemtypeinsertion(cls, itemgroup, modelname, indent) -> str:
"""Return a string defining the required types for the given
combination of an exchange item group and an application model.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_itemtypeinsertion(
... | Return a string defining the required types for the given
combination of an exchange item group and an application model.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_itemtypeinsertion(
... 'setitems', 'hland_v1', 1)) # doctest: +ELLIPSIS
<com... | entailment |
def get_nodesitemtypeinsertion(cls, itemgroup, indent) -> str:
"""Return a string defining the required types for the given
combination of an exchange item group and |Node| objects.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_nodesitemtypeinsertion(
...... | Return a string defining the required types for the given
combination of an exchange item group and |Node| objects.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_nodesitemtypeinsertion(
... 'setitems', 1)) # doctest: +ELLIPSIS
<complexType name... | entailment |
def get_subgroupsiteminsertion(cls, itemgroup, modelname, indent) -> str:
"""Return a string defining the required types for the given
combination of an exchange item group and an application model.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_subgroupsiteminser... | Return a string defining the required types for the given
combination of an exchange item group and an application model.
>>> from hydpy.auxs.xmltools import XSDWriter
>>> print(XSDWriter.get_subgroupsiteminsertion(
... 'setitems', 'hland_v1', 1)) # doctest: +ELLIPSIS
... | entailment |
def get_subgroupiteminsertion(
cls, itemgroup, model, subgroup, indent) -> str:
"""Return a string defining the required types for the given
combination of an exchange item group and a specific variable
subgroup of an application model or class |Node|.
Note that for `setitem... | Return a string defining the required types for the given
combination of an exchange item group and a specific variable
subgroup of an application model or class |Node|.
Note that for `setitems` and `getitems` `setitemType` and
`getitemType` are referenced, respectively, and for all oth... | entailment |
def array2mask(cls, array=None, **kwargs):
"""Create a new mask object based on the given |numpy.ndarray|
and return it."""
kwargs['dtype'] = bool
if array is None:
return numpy.ndarray.__new__(cls, 0, **kwargs)
return numpy.asarray(array, **kwargs).view(cls) | Create a new mask object based on the given |numpy.ndarray|
and return it. | entailment |
def new(cls, variable, **kwargs):
"""Return a new |DefaultMask| object associated with the
given |Variable| object."""
return cls.array2mask(numpy.full(variable.shape, True)) | Return a new |DefaultMask| object associated with the
given |Variable| object. | entailment |
def new(cls, variable, **kwargs):
"""Return a new |IndexMask| object of the same shape as the
parameter referenced by |property| |IndexMask.refindices|.
Entries are only |True|, if the integer values of the
respective entries of the referenced parameter are contained
in the |Inde... | Return a new |IndexMask| object of the same shape as the
parameter referenced by |property| |IndexMask.refindices|.
Entries are only |True|, if the integer values of the
respective entries of the referenced parameter are contained
in the |IndexMask| class attribute tuple `RELEVANT_VALUES... | entailment |
def relevantindices(self) -> List[int]:
"""A |list| of all currently relevant indices, calculated as an
intercection of the (constant) class attribute `RELEVANT_VALUES`
and the (variable) property |IndexMask.refindices|."""
return [idx for idx in numpy.unique(self.refindices.values)
... | A |list| of all currently relevant indices, calculated as an
intercection of the (constant) class attribute `RELEVANT_VALUES`
and the (variable) property |IndexMask.refindices|. | entailment |
def calc_qref_v1(self):
"""Determine the reference discharge within the given space-time interval.
Required state sequences:
|QZ|
|QA|
Calculated flux sequence:
|QRef|
Basic equation:
:math:`QRef = \\frac{QZ_{new}+QZ_{old}+QA_{old}}{3}`
Example:
>>> from hydpy.mo... | Determine the reference discharge within the given space-time interval.
Required state sequences:
|QZ|
|QA|
Calculated flux sequence:
|QRef|
Basic equation:
:math:`QRef = \\frac{QZ_{new}+QZ_{old}+QA_{old}}{3}`
Example:
>>> from hydpy.models.lstream import *
>... | entailment |
def calc_rk_v1(self):
"""Determine the actual traveling time of the water (not of the wave!).
Required derived parameter:
|Sek|
Required flux sequences:
|AG|
|QRef|
Calculated flux sequence:
|RK|
Basic equation:
:math:`RK = \\frac{Laen \\cdot A}{QRef}`
Examples... | Determine the actual traveling time of the water (not of the wave!).
Required derived parameter:
|Sek|
Required flux sequences:
|AG|
|QRef|
Calculated flux sequence:
|RK|
Basic equation:
:math:`RK = \\frac{Laen \\cdot A}{QRef}`
Examples:
First, note that t... | entailment |
def calc_am_um_v1(self):
"""Calculate the flown through area and the wetted perimeter
of the main channel.
Note that the main channel is assumed to have identical slopes on
both sides and that water flowing exactly above the main channel is
contributing to |AM|. Both theoretical surfaces seperatin... | Calculate the flown through area and the wetted perimeter
of the main channel.
Note that the main channel is assumed to have identical slopes on
both sides and that water flowing exactly above the main channel is
contributing to |AM|. Both theoretical surfaces seperating water
above the main chann... | entailment |
def calc_qm_v1(self):
"""Calculate the discharge of the main channel after Manning-Strickler.
Required control parameters:
|EKM|
|SKM|
|Gef|
Required flux sequence:
|AM|
|UM|
Calculated flux sequence:
|lstream_fluxes.QM|
Examples:
For appropriate stri... | Calculate the discharge of the main channel after Manning-Strickler.
Required control parameters:
|EKM|
|SKM|
|Gef|
Required flux sequence:
|AM|
|UM|
Calculated flux sequence:
|lstream_fluxes.QM|
Examples:
For appropriate strictly positive values:
... | entailment |
def calc_av_uv_v1(self):
"""Calculate the flown through area and the wetted perimeter of both
forelands.
Note that the each foreland lies between the main channel and one
outer embankment and that water flowing exactly above the a foreland
is contributing to |AV|. The theoretical surface seperatin... | Calculate the flown through area and the wetted perimeter of both
forelands.
Note that the each foreland lies between the main channel and one
outer embankment and that water flowing exactly above the a foreland
is contributing to |AV|. The theoretical surface seperating water
above the main chann... | entailment |
def calc_qv_v1(self):
"""Calculate the discharge of both forelands after Manning-Strickler.
Required control parameters:
|EKV|
|SKV|
|Gef|
Required flux sequence:
|AV|
|UV|
Calculated flux sequence:
|lstream_fluxes.QV|
Examples:
For appropriate strict... | Calculate the discharge of both forelands after Manning-Strickler.
Required control parameters:
|EKV|
|SKV|
|Gef|
Required flux sequence:
|AV|
|UV|
Calculated flux sequence:
|lstream_fluxes.QV|
Examples:
For appropriate strictly positive values:
... | entailment |
def calc_avr_uvr_v1(self):
"""Calculate the flown through area and the wetted perimeter of both
outer embankments.
Note that each outer embankment lies beyond its foreland and that all
water flowing exactly above the a embankment is added to |AVR|.
The theoretical surface seperating water above the... | Calculate the flown through area and the wetted perimeter of both
outer embankments.
Note that each outer embankment lies beyond its foreland and that all
water flowing exactly above the a embankment is added to |AVR|.
The theoretical surface seperating water above the foreland from water
above its... | entailment |
def calc_qvr_v1(self):
"""Calculate the discharge of both outer embankments after
Manning-Strickler.
Required control parameters:
|EKV|
|SKV|
|Gef|
Required flux sequence:
|AVR|
|UVR|
Calculated flux sequence:
|QVR|
Examples:
For appropriate stric... | Calculate the discharge of both outer embankments after
Manning-Strickler.
Required control parameters:
|EKV|
|SKV|
|Gef|
Required flux sequence:
|AVR|
|UVR|
Calculated flux sequence:
|QVR|
Examples:
For appropriate strictly positive values:
... | entailment |
def calc_ag_v1(self):
"""Sum the through flown area of the total cross section.
Required flux sequences:
|AM|
|AV|
|AVR|
Calculated flux sequence:
|AG|
Example:
>>> from hydpy.models.lstream import *
>>> parameterstep()
>>> fluxes.am = 1.0
>>> ... | Sum the through flown area of the total cross section.
Required flux sequences:
|AM|
|AV|
|AVR|
Calculated flux sequence:
|AG|
Example:
>>> from hydpy.models.lstream import *
>>> parameterstep()
>>> fluxes.am = 1.0
>>> fluxes.av= 2.0, 3.0
>... | entailment |
def calc_qg_v1(self):
"""Calculate the discharge of the total cross section.
Method |calc_qg_v1| applies the actual versions of all methods for
calculating the flown through areas, wetted perimeters and discharges
of the different cross section compartments. Hence its requirements
might be differe... | Calculate the discharge of the total cross section.
Method |calc_qg_v1| applies the actual versions of all methods for
calculating the flown through areas, wetted perimeters and discharges
of the different cross section compartments. Hence its requirements
might be different for various application mo... | entailment |
def calc_hmin_qmin_hmax_qmax_v1(self):
"""Determine an starting interval for iteration methods as the one
implemented in method |calc_h_v1|.
The resulting interval is determined in a manner, that on the
one hand :math:`Qmin \\leq QRef \\leq Qmax` is fulfilled and on the
other hand the results of me... | Determine an starting interval for iteration methods as the one
implemented in method |calc_h_v1|.
The resulting interval is determined in a manner, that on the
one hand :math:`Qmin \\leq QRef \\leq Qmax` is fulfilled and on the
other hand the results of method |calc_qg_v1| are continuous
for :math... | entailment |
def calc_h_v1(self):
"""Approximate the water stage resulting in a certain reference discarge
with the Pegasus iteration method.
Required control parameters:
|QTol|
|HTol|
Required flux sequence:
|QRef|
Modified aide sequences:
|HMin|
|HMax|
|QMin|
|QMax|... | Approximate the water stage resulting in a certain reference discarge
with the Pegasus iteration method.
Required control parameters:
|QTol|
|HTol|
Required flux sequence:
|QRef|
Modified aide sequences:
|HMin|
|HMax|
|QMin|
|QMax|
Calculated flux sequen... | entailment |
def calc_qa_v1(self):
"""Calculate outflow.
The working equation is the analytical solution of the linear storage
equation under the assumption of constant change in inflow during
the simulation time step.
Required flux sequence:
|RK|
Required state sequence:
|QZ|
Updated sta... | Calculate outflow.
The working equation is the analytical solution of the linear storage
equation under the assumption of constant change in inflow during
the simulation time step.
Required flux sequence:
|RK|
Required state sequence:
|QZ|
Updated state sequence:
|QA|
... | entailment |
def pick_q_v1(self):
"""Update inflow."""
sta = self.sequences.states.fastaccess
inl = self.sequences.inlets.fastaccess
sta.qz = 0.
for idx in range(inl.len_q):
sta.qz += inl.q[idx][0] | Update inflow. | entailment |
def pass_q_v1(self):
"""Update outflow."""
sta = self.sequences.states.fastaccess
out = self.sequences.outlets.fastaccess
out.q[0] += sta.qa | Update outflow. | entailment |
def calc_tc_v1(self):
"""Adjust the measured air temperature to the altitude of the
individual zones.
Required control parameters:
|NmbZones|
|TCAlt|
|ZoneZ|
|ZRelT|
Required input sequence:
|hland_inputs.T|
Calculated flux sequences:
|TC|
Basic equation:
... | Adjust the measured air temperature to the altitude of the
individual zones.
Required control parameters:
|NmbZones|
|TCAlt|
|ZoneZ|
|ZRelT|
Required input sequence:
|hland_inputs.T|
Calculated flux sequences:
|TC|
Basic equation:
:math:`TC = T - TCAlt \... | entailment |
def calc_tmean_v1(self):
"""Calculate the areal mean temperature of the subbasin.
Required derived parameter:
|RelZoneArea|
Required flux sequence:
|TC|
Calculated flux sequences:
|TMean|
Examples:
Prepare two zones, the first one being twice as large
as the se... | Calculate the areal mean temperature of the subbasin.
Required derived parameter:
|RelZoneArea|
Required flux sequence:
|TC|
Calculated flux sequences:
|TMean|
Examples:
Prepare two zones, the first one being twice as large
as the second one:
>>> from hydp... | entailment |
def calc_fracrain_v1(self):
"""Determine the temperature-dependent fraction of (liquid) rainfall
and (total) precipitation.
Required control parameters:
|NmbZones|
|TT|,
|TTInt|
Required flux sequence:
|TC|
Calculated flux sequences:
|FracRain|
Basic equation:
... | Determine the temperature-dependent fraction of (liquid) rainfall
and (total) precipitation.
Required control parameters:
|NmbZones|
|TT|,
|TTInt|
Required flux sequence:
|TC|
Calculated flux sequences:
|FracRain|
Basic equation:
:math:`FracRain = \\frac{TC-(T... | entailment |
def calc_rfc_sfc_v1(self):
"""Calculate the corrected fractions rainfall/snowfall and total
precipitation.
Required control parameters:
|NmbZones|
|RfCF|
|SfCF|
Calculated flux sequences:
|RfC|
|SfC|
Basic equations:
:math:`RfC = RfCF \\cdot FracRain` \n
... | Calculate the corrected fractions rainfall/snowfall and total
precipitation.
Required control parameters:
|NmbZones|
|RfCF|
|SfCF|
Calculated flux sequences:
|RfC|
|SfC|
Basic equations:
:math:`RfC = RfCF \\cdot FracRain` \n
:math:`SfC = SfCF \\cdot (1 - Frac... | entailment |
def calc_pc_v1(self):
"""Apply the precipitation correction factors and adjust precipitation
to the altitude of the individual zones.
Required control parameters:
|NmbZones|
|PCorr|
|PCAlt|
|ZoneZ|
|ZRelP|
Required input sequence:
|P|
Required flux sequences:
... | Apply the precipitation correction factors and adjust precipitation
to the altitude of the individual zones.
Required control parameters:
|NmbZones|
|PCorr|
|PCAlt|
|ZoneZ|
|ZRelP|
Required input sequence:
|P|
Required flux sequences:
|RfC|
|SfC|
C... | entailment |
def calc_ep_v1(self):
"""Adjust potential norm evaporation to the actual temperature.
Required control parameters:
|NmbZones|
|ETF|
Required input sequence:
|EPN|
|TN|
Required flux sequence:
|TMean|
Calculated flux sequences:
|EP|
Basic equation:
:... | Adjust potential norm evaporation to the actual temperature.
Required control parameters:
|NmbZones|
|ETF|
Required input sequence:
|EPN|
|TN|
Required flux sequence:
|TMean|
Calculated flux sequences:
|EP|
Basic equation:
:math:`EP = EPN \\cdot (1 + ET... | entailment |
def calc_epc_v1(self):
"""Apply the evaporation correction factors and adjust evaporation
to the altitude of the individual zones.
Calculate the areal mean of (uncorrected) potential evaporation
for the subbasin, adjust it to the individual zones in accordance
with their heights and perform some co... | Apply the evaporation correction factors and adjust evaporation
to the altitude of the individual zones.
Calculate the areal mean of (uncorrected) potential evaporation
for the subbasin, adjust it to the individual zones in accordance
with their heights and perform some corrections, among which one
... | entailment |
def calc_tf_ic_v1(self):
"""Calculate throughfall and update the interception storage
accordingly.
Required control parameters:
|NmbZones|
|ZoneType|
|IcMax|
Required flux sequences:
|PC|
Calculated fluxes sequences:
|TF|
Updated state sequence:
|Ic|
... | Calculate throughfall and update the interception storage
accordingly.
Required control parameters:
|NmbZones|
|ZoneType|
|IcMax|
Required flux sequences:
|PC|
Calculated fluxes sequences:
|TF|
Updated state sequence:
|Ic|
Basic equation:
:math:`TF ... | entailment |
def calc_ei_ic_v1(self):
"""Calculate interception evaporation and update the interception
storage accordingly.
Required control parameters:
|NmbZones|
|ZoneType|
Required flux sequences:
|EPC|
Calculated fluxes sequences:
|EI|
Updated state sequence:
|Ic|
... | Calculate interception evaporation and update the interception
storage accordingly.
Required control parameters:
|NmbZones|
|ZoneType|
Required flux sequences:
|EPC|
Calculated fluxes sequences:
|EI|
Updated state sequence:
|Ic|
Basic equation:
:math:`EI ... | entailment |
def calc_sp_wc_v1(self):
"""Add throughfall to the snow layer.
Required control parameters:
|NmbZones|
|ZoneType|
Required flux sequences:
|TF|
|RfC|
|SfC|
Updated state sequences:
|WC|
|SP|
Basic equations:
:math:`\\frac{dSP}{dt} = TF \\cdot \\fra... | Add throughfall to the snow layer.
Required control parameters:
|NmbZones|
|ZoneType|
Required flux sequences:
|TF|
|RfC|
|SfC|
Updated state sequences:
|WC|
|SP|
Basic equations:
:math:`\\frac{dSP}{dt} = TF \\cdot \\frac{SfC}{SfC+RfC}` \n
:math:... | entailment |
def calc_refr_sp_wc_v1(self):
"""Calculate refreezing of the water content within the snow layer and
update both the snow layers ice and the water content.
Required control parameters:
|NmbZones|
|ZoneType|
|CFMax|
|CFR|
Required derived parameter:
|TTM|
Required flu... | Calculate refreezing of the water content within the snow layer and
update both the snow layers ice and the water content.
Required control parameters:
|NmbZones|
|ZoneType|
|CFMax|
|CFR|
Required derived parameter:
|TTM|
Required flux sequences:
|TC|
Calculat... | entailment |
def calc_in_wc_v1(self):
"""Calculate the actual water release from the snow layer due to the
exceedance of the snow layers capacity for (liquid) water.
Required control parameters:
|NmbZones|
|ZoneType|
|WHC|
Required state sequence:
|SP|
Required flux sequence
|TF|... | Calculate the actual water release from the snow layer due to the
exceedance of the snow layers capacity for (liquid) water.
Required control parameters:
|NmbZones|
|ZoneType|
|WHC|
Required state sequence:
|SP|
Required flux sequence
|TF|
Calculated fluxes sequence... | entailment |
def calc_glmelt_in_v1(self):
"""Calculate melting from glaciers which are actually not covered by
a snow layer and add it to the water release of the snow module.
Required control parameters:
|NmbZones|
|ZoneType|
|GMelt|
Required state sequence:
|SP|
Required flux sequenc... | Calculate melting from glaciers which are actually not covered by
a snow layer and add it to the water release of the snow module.
Required control parameters:
|NmbZones|
|ZoneType|
|GMelt|
Required state sequence:
|SP|
Required flux sequence:
|TC|
Calculated fluxes... | entailment |
def calc_r_sm_v1(self):
"""Calculate effective precipitation and update soil moisture.
Required control parameters:
|NmbZones|
|ZoneType|
|FC|
|Beta|
Required fluxes sequence:
|In_|
Calculated flux sequence:
|R|
Updated state sequence:
|SM|
Basic eq... | Calculate effective precipitation and update soil moisture.
Required control parameters:
|NmbZones|
|ZoneType|
|FC|
|Beta|
Required fluxes sequence:
|In_|
Calculated flux sequence:
|R|
Updated state sequence:
|SM|
Basic equations:
:math:`\\frac{dS... | entailment |
def calc_cf_sm_v1(self):
"""Calculate capillary flow and update soil moisture.
Required control parameters:
|NmbZones|
|ZoneType|
|FC|
|CFlux|
Required fluxes sequence:
|R|
Required state sequence:
|UZ|
Calculated flux sequence:
|CF|
Updated state s... | Calculate capillary flow and update soil moisture.
Required control parameters:
|NmbZones|
|ZoneType|
|FC|
|CFlux|
Required fluxes sequence:
|R|
Required state sequence:
|UZ|
Calculated flux sequence:
|CF|
Updated state sequence:
|SM|
Basic e... | entailment |
def calc_ea_sm_v1(self):
"""Calculate soil evaporation and update soil moisture.
Required control parameters:
|NmbZones|
|ZoneType|
|FC|
|LP|
|ERed|
Required fluxes sequences:
|EPC|
|EI|
Required state sequence:
|SP|
Calculated flux sequence:
... | Calculate soil evaporation and update soil moisture.
Required control parameters:
|NmbZones|
|ZoneType|
|FC|
|LP|
|ERed|
Required fluxes sequences:
|EPC|
|EI|
Required state sequence:
|SP|
Calculated flux sequence:
|EA|
Updated state sequenc... | entailment |
def calc_inuz_v1(self):
"""Accumulate the total inflow into the upper zone layer.
Required control parameters:
|NmbZones|
|ZoneType|
Required derived parameters:
|RelLandZoneArea|
Required fluxes sequences:
|R|
|CF|
Calculated flux sequence:
|InUZ|
Basic ... | Accumulate the total inflow into the upper zone layer.
Required control parameters:
|NmbZones|
|ZoneType|
Required derived parameters:
|RelLandZoneArea|
Required fluxes sequences:
|R|
|CF|
Calculated flux sequence:
|InUZ|
Basic equation:
:math:`InUZ = R... | entailment |
def calc_contriarea_v1(self):
"""Determine the relative size of the contributing area of the whole
subbasin.
Required control parameters:
|NmbZones|
|ZoneType|
|RespArea|
|FC|
|Beta|
Required derived parameter:
|RelSoilArea|
Required state sequence:
|SM|
... | Determine the relative size of the contributing area of the whole
subbasin.
Required control parameters:
|NmbZones|
|ZoneType|
|RespArea|
|FC|
|Beta|
Required derived parameter:
|RelSoilArea|
Required state sequence:
|SM|
Calculated fluxes sequences:
... | entailment |
def calc_q0_perc_uz_v1(self):
"""Perform the upper zone layer routine which determines percolation
to the lower zone layer and the fast response of the hland model.
Note that the system behaviour of this method depends strongly on the
specifications of the options |RespArea| and |RecStep|.
Required... | Perform the upper zone layer routine which determines percolation
to the lower zone layer and the fast response of the hland model.
Note that the system behaviour of this method depends strongly on the
specifications of the options |RespArea| and |RecStep|.
Required control parameters:
|RecStep|
... | entailment |
def calc_lz_v1(self):
"""Update the lower zone layer in accordance with percolation from
upper groundwater to lower groundwater and/or in accordance with
lake precipitation.
Required control parameters:
|NmbZones|
|ZoneType|
Required derived parameters:
|RelLandArea|
|RelZo... | Update the lower zone layer in accordance with percolation from
upper groundwater to lower groundwater and/or in accordance with
lake precipitation.
Required control parameters:
|NmbZones|
|ZoneType|
Required derived parameters:
|RelLandArea|
|RelZoneArea|
Required fluxes ... | entailment |
def calc_el_lz_v1(self):
"""Calculate lake evaporation.
Required control parameters:
|NmbZones|
|ZoneType|
|TTIce|
Required derived parameters:
|RelZoneArea|
Required fluxes sequences:
|TC|
|EPC|
Updated state sequence:
|LZ|
Basic equa... | Calculate lake evaporation.
Required control parameters:
|NmbZones|
|ZoneType|
|TTIce|
Required derived parameters:
|RelZoneArea|
Required fluxes sequences:
|TC|
|EPC|
Updated state sequence:
|LZ|
Basic equations:
:math:`\\frac{dLZ... | entailment |
def calc_q1_lz_v1(self):
"""Calculate the slow response of the lower zone layer.
Required control parameters:
|K4|
|Gamma|
Calculated fluxes sequence:
|Q1|
Updated state sequence:
|LZ|
Basic equations:
:math:`\\frac{dLZ}{dt} = -Q1` \n
:math:`Q1 = \... | Calculate the slow response of the lower zone layer.
Required control parameters:
|K4|
|Gamma|
Calculated fluxes sequence:
|Q1|
Updated state sequence:
|LZ|
Basic equations:
:math:`\\frac{dLZ}{dt} = -Q1` \n
:math:`Q1 = \\Bigl \\lbrace
{
... | entailment |
def calc_inuh_v1(self):
"""Calculate the unit hydrograph input.
Required derived parameters:
|RelLandArea|
Required flux sequences:
|Q0|
|Q1|
Calculated flux sequence:
|InUH|
Basic equation:
:math:`InUH = Q0 + Q1`
Example:
The unit hydrographs receiv... | Calculate the unit hydrograph input.
Required derived parameters:
|RelLandArea|
Required flux sequences:
|Q0|
|Q1|
Calculated flux sequence:
|InUH|
Basic equation:
:math:`InUH = Q0 + Q1`
Example:
The unit hydrographs receives base flow from the whole sub... | entailment |
def calc_outuh_quh_v1(self):
"""Calculate the unit hydrograph output (convolution).
Required derived parameters:
|UH|
Required flux sequences:
|Q0|
|Q1|
|InUH|
Updated log sequence:
|QUH|
Calculated flux sequence:
|OutUH|
Examples:
Pr... | Calculate the unit hydrograph output (convolution).
Required derived parameters:
|UH|
Required flux sequences:
|Q0|
|Q1|
|InUH|
Updated log sequence:
|QUH|
Calculated flux sequence:
|OutUH|
Examples:
Prepare a unit hydrograph with only th... | entailment |
def calc_qt_v1(self):
"""Calculate the total discharge after possible abstractions.
Required control parameter:
|Abstr|
Required flux sequence:
|OutUH|
Calculated flux sequence:
|QT|
Basic equation:
:math:`QT = max(OutUH - Abstr, 0)`
Examples:
Trying to ab... | Calculate the total discharge after possible abstractions.
Required control parameter:
|Abstr|
Required flux sequence:
|OutUH|
Calculated flux sequence:
|QT|
Basic equation:
:math:`QT = max(OutUH - Abstr, 0)`
Examples:
Trying to abstract less then available, a... | entailment |
def save(self, parameterstep=None, simulationstep=None):
"""Save all defined auxiliary control files.
The target path is taken from the |ControlManager| object stored
in module |pub|. Hence we initialize one and override its
|property| `currentpath` with a simple |str| object defining ... | Save all defined auxiliary control files.
The target path is taken from the |ControlManager| object stored
in module |pub|. Hence we initialize one and override its
|property| `currentpath` with a simple |str| object defining the
test target path:
>>> from hydpy import pub
... | entailment |
def remove(self, *values):
"""Remove the defined variables.
The variables to be removed can be selected in two ways. But the
first example shows that passing nothing or an empty iterable to
method |Variable2Auxfile.remove| does not remove any variable:
>>> from hydpy import du... | Remove the defined variables.
The variables to be removed can be selected in two ways. But the
first example shows that passing nothing or an empty iterable to
method |Variable2Auxfile.remove| does not remove any variable:
>>> from hydpy import dummies
>>> v2af = dummies.v2af
... | entailment |
def filenames(self):
"""A list of all handled auxiliary file names.
>>> from hydpy import dummies
>>> dummies.v2af.filenames
['file1', 'file2']
"""
fns = set()
for fn2var in self._type2filename2variable.values():
fns.update(fn2var.keys())
retu... | A list of all handled auxiliary file names.
>>> from hydpy import dummies
>>> dummies.v2af.filenames
['file1', 'file2'] | entailment |
def get_filename(self, variable):
"""Return the auxiliary file name the given variable is allocated
to or |None| if the given variable is not allocated to any
auxiliary file name.
>>> from hydpy import dummies
>>> eqb = dummies.v2af.eqb[0]
>>> dummies.v2af.get_filename(e... | Return the auxiliary file name the given variable is allocated
to or |None| if the given variable is not allocated to any
auxiliary file name.
>>> from hydpy import dummies
>>> eqb = dummies.v2af.eqb[0]
>>> dummies.v2af.get_filename(eqb)
'file1'
>>> eqb += 500.0
... | entailment |
def update(self):
"""Calculate the smoothing parameter values.
The following example is explained in some detail in module
|smoothtools|:
>>> from hydpy import pub
>>> pub.timegrids = '2000.01.01', '2000.01.03', '1d'
>>> from hydpy.models.dam import *
>>> parame... | Calculate the smoothing parameter values.
The following example is explained in some detail in module
|smoothtools|:
>>> from hydpy import pub
>>> pub.timegrids = '2000.01.01', '2000.01.03', '1d'
>>> from hydpy.models.dam import *
>>> parameterstep()
>>> remoted... | entailment |
def update(self):
"""Calculate the smoothing parameter value.
The following example is explained in some detail in module
|smoothtools|:
>>> from hydpy.models.dam import *
>>> parameterstep()
>>> waterlevelminimumremotetolerance(0.0)
>>> derived.waterlevelminimu... | Calculate the smoothing parameter value.
The following example is explained in some detail in module
|smoothtools|:
>>> from hydpy.models.dam import *
>>> parameterstep()
>>> waterlevelminimumremotetolerance(0.0)
>>> derived.waterlevelminimumremotesmoothpar.update()
... | entailment |
def update(self):
"""Calculate the smoothing parameter value.
The following example is explained in some detail in module
|smoothtools|:
>>> from hydpy.models.dam import *
>>> parameterstep()
>>> highestremotedischarge(1.0)
>>> highestremotetolerance(0.0)
... | Calculate the smoothing parameter value.
The following example is explained in some detail in module
|smoothtools|:
>>> from hydpy.models.dam import *
>>> parameterstep()
>>> highestremotedischarge(1.0)
>>> highestremotetolerance(0.0)
>>> derived.highestremotesm... | entailment |
def run_subprocess(command: str, verbose: bool = True, blocking: bool = True) \
-> Optional[subprocess.Popen]:
"""Execute the given command in a new process.
Only when both `verbose` and `blocking` are |True|, |run_subprocess|
prints all responses to the current value of |sys.stdout|:
>>> from... | Execute the given command in a new process.
Only when both `verbose` and `blocking` are |True|, |run_subprocess|
prints all responses to the current value of |sys.stdout|:
>>> from hydpy import run_subprocess
>>> import platform
>>> esc = '' if 'windows' in platform.platform().lower() else '\\\\'
... | entailment |
def exec_commands(commands: str, **parameters: Any) -> None:
"""Execute the given Python commands.
Function |exec_commands| is thought for testing purposes only (see
the main documentation on module |hyd|). Seperate individual commands
by semicolons and replaced whitespaces with underscores:
>>> ... | Execute the given Python commands.
Function |exec_commands| is thought for testing purposes only (see
the main documentation on module |hyd|). Seperate individual commands
by semicolons and replaced whitespaces with underscores:
>>> from hydpy.exe.commandtools import exec_commands
>>> import sys
... | entailment |
def prepare_logfile(filename: str) -> str:
"""Prepare an empty log file eventually and return its absolute path.
When passing the "filename" `stdout`, |prepare_logfile| does not
prepare any file and just returns `stdout`:
>>> from hydpy.exe.commandtools import prepare_logfile
>>> prepare_logfile('... | Prepare an empty log file eventually and return its absolute path.
When passing the "filename" `stdout`, |prepare_logfile| does not
prepare any file and just returns `stdout`:
>>> from hydpy.exe.commandtools import prepare_logfile
>>> prepare_logfile('stdout')
'stdout'
When passing the "filen... | entailment |
def execute_scriptfunction() -> None:
"""Execute a HydPy script function.
Function |execute_scriptfunction| is indirectly applied and
explained in the documentation on module |hyd|.
"""
try:
args_given = []
kwargs_given = {}
for arg in sys.argv[1:]:
if len(arg) <... | Execute a HydPy script function.
Function |execute_scriptfunction| is indirectly applied and
explained in the documentation on module |hyd|. | entailment |
def parse_argument(string: str) -> Union[str, Tuple[str, str]]:
"""Return a single value for a string understood as a positional
argument or a |tuple| containing a keyword and its value for a
string understood as a keyword argument.
|parse_argument| is intended to be used as a helper function for
f... | Return a single value for a string understood as a positional
argument or a |tuple| containing a keyword and its value for a
string understood as a keyword argument.
|parse_argument| is intended to be used as a helper function for
function |execute_scriptfunction| only. See the following
examples ... | entailment |
def print_textandtime(text: str) -> None:
"""Print the given string and the current date and time with high
precision for logging purposes.
>>> from hydpy.exe.commandtools import print_textandtime
>>> from hydpy.core.testtools import mock_datetime_now
>>> from datetime import datetime
>>> with ... | Print the given string and the current date and time with high
precision for logging purposes.
>>> from hydpy.exe.commandtools import print_textandtime
>>> from hydpy.core.testtools import mock_datetime_now
>>> from datetime import datetime
>>> with mock_datetime_now(datetime(2000, 1, 1, 12, 30, 0,... | entailment |
def write(self, string: str) -> None:
"""Write the given string as explained in the main documentation
on class |LogFileInterface|."""
self.logfile.write('\n'.join(
f'{self._string}{substring}' if substring else ''
for substring in string.split('\n'))) | Write the given string as explained in the main documentation
on class |LogFileInterface|. | entailment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.